小编Jos*_*son的帖子

请求已中止:无法创建SSL/TLS安全通道

我的客户通过他们的SSL和Internet Explorer了解了我的问题.他们说他们在访问URL时会遇到信任问题.

我通过HTTPS访问JSON.该网站位于一台服务器上,我在本地计算机上使用控制台应用程序.我试图绕过SSL证书,但是,我的代码仍然失败.

我可以改变HttpWebRequest来解决这个问题吗?

我使用此代码得到此错误:

    // You must change the URL to point to your Web server.
        HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
        req.Method = "GET";
        req.AllowAutoRedirect = true;

        // allows for validation of SSL conversations
        ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };


        WebResponse respon = req.GetResponse();
        Stream res = respon.GetResponseStream();

        string ret = "";
        byte[] buffer = new byte[1048];
        int read = 0;
        while ((read = res.Read(buffer, 0, buffer.Length)) > 0)
        {
            //Console.Write(Encoding.ASCII.GetString(buffer, 0, read));
            ret += Encoding.ASCII.GetString(buffer, 0, read);
        } …
Run Code Online (Sandbox Code Playgroud)

c# asp.net ssl httpwebrequest

56
推荐指数
5
解决办法
12万
查看次数

注册应用程序失败,因为文件位于网络共享上.在注册包之前将文件复制到本地计算机

我使用这些示例来构建Windows 8应用程序:

http://code.msdn.microsoft.com/windowsapps/Getting-started-with-C-and-41e15af5

(注意:该链接是陈旧的,这可能是正确的:C#和Visual Basic入门:Hello World样本 )

当我尝试运行Windows 8设备模拟器时,出现此错误:

错误1错误:DEP0700:应用程序注册失败.拒绝从文件注册的请求:// psf/Home/Desktop /获得%20started%20with%20C#%20和%20Visual%20Basic%20Hello%20World%20and%20Blog%20reader%20samples%20(1)/ C#/ HelloWorld_Part1/bin/Debug/AppX/AppxManifest.xml,因为文件位于网络共享上.在注册包之前将文件复制到本地计算机.(0x80073cf9)HelloWorld_Part1

我在Mac上使用Paralells.什么文件夹不是网络共享?

c# windows

10
推荐指数
2
解决办法
3857
查看次数

外键必须映射到概念方面参与外键关联的某些AssociationSet或EntitySets

我试图在实体框架中使用一对一(主,细节)关系,但是,我收到此错误:

从第254,443行开始映射片段的问题:从表options_Advanced(ProductID)到表产品(catalogid)的外键约束'options_Advanced_FK00'::映射不足:外键必须映射到参与外键关联的某些AssociationSet或EntitySets在概念方面

这是设计师中的关联:

在此输入图像描述

它说产品 - > 0..1 options_Advanced

我先使用模型而不是代码.我的选项高级表有一个与每条记录关联的产品

制品

  • ID
  • 采用catalogId
  • 名称

Options_Advanced

  • ID
  • 产品ID
  • 名称

entity-framework

9
推荐指数
2
解决办法
6929
查看次数

加密Web.config Windows Azure

我正在使用Windows Azure的共享网站.我想加密我的web.config部分,但是,我收到此错误:

无法使用提供程序'RsaProtectedConfigurationProvider'解密.来自提供程序的错误消息:无法打开RSA密钥容器.

我的网站中有一个页面会对该文件进行加密,但是,几个小时后我就会收到此错误.我是否需要将机器密钥发送到Azure,或者他们是否有可以使用的密钥?

要加密我的配置文件,我使用以下代码:

    /// <summary>
    /// About view for the website.
    /// </summary>
    /// <returns>Action Result.</returns>
    public ActionResult About()
    {
        Configuration objConfig =
          WebConfigurationManager.OpenWebConfiguration(Request.ApplicationPath);
        AppSettingsSection objAppsettings =
          (AppSettingsSection)objConfig.GetSection("appSettings");
        if (!objAppsettings.SectionInformation.IsProtected)
        {
            objAppsettings.SectionInformation.ProtectSection(
                           "RsaProtectedConfigurationProvider");
            objAppsettings.SectionInformation.ForceSave = true;
            objConfig.Save(ConfigurationSaveMode.Modified);
        }

        return View();
    }
Run Code Online (Sandbox Code Playgroud)

azure

7
推荐指数
1
解决办法
1579
查看次数

找不到Microsoft.WindowsAzure.targets

我使用Visual Studio Online将我的网站发布到Azure.我正在使用Visual Studio 2013 Professional.我没有对我的CloudService文件进行任何更改,今天就开始了.文件路径是否正确?我收到此错误消息:

d:\ a\src\XX\Azure\CloudService1\CloudService1.ccproj(70):导入的项目"C:\ Program Files(x86)\ MSBuild\Microsoft\VisualStudio\v14.0\Windows Azure Tools\2.3\Microsoft .WindowsAzure.targets"没找到.确认声明中的路径是否正确,以及该文件是否存在于磁盘上.

在我的解决方案文件的第一行,这是版本:

Microsoft Visual Studio解决方案文件,格式版本12.00

Visual Studio 2013

VisualStudioVersion = 12.0.30501.0

我没有对这个区域做任何改动,所以我不确定发生了什么.

msbuild tfs azure visual-studio

5
推荐指数
0
解决办法
2862
查看次数

无法加载文件或程序集“BouncyCastle.Crypto,版本=1.8.1.0,Culture=neutral,PublicKeyToken=null”或其依赖项之一

我正在尝试将 Walmart .NET SDK 集成到 .NET 4.61 MVC 5 应用程序中。使用 NuGet,我添加了对 BouncyCastle.Crypto 1.8.1.0 的引用。

SDK 使用 .NET Standard 1.3 并引用 BouncyCastle.Crypto 1.8.1.3:

https://github.com/walmartlabs/partnerapi_sdk_dotnet

1.8.1.3 不适用于 .NET 4.61。

{"Could not load file or assembly 'BouncyCastle.Crypto, Version=1.8.1.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)":"BouncyCastle.Crypto, Version=1.8.1.0, Culture=neutral, PublicKeyToken=null"}

=== Pre-bind state information ===
LOG: DisplayName = BouncyCastle.Crypto, Version=1.8.1.0, Culture=neutral, PublicKeyToken=null
 (Fully-specified)
LOG: Appbase = file:///C:/Users/example_user/Source/Workspaces/CCC/Test/example_app.Test.DataAccessUnitTest/bin/Debug
LOG: Initial PrivatePath …
Run Code Online (Sandbox Code Playgroud)

c#

5
推荐指数
1
解决办法
1万
查看次数

XML 序列化错误

我正在尝试反序列化 XML,但收到此错误:

无法生成临时类(结果=1)。

错误 CS0030:无法将类型“responseReturnSalesOrder[]”转换为“responseReturnSalesOrder”

错误 CS0029:无法将类型“responseReturnSalesOrder”隐式转换为“responseReturnSalesOrder[]”

我的 xml 包含一个名为 的元素,但我似乎无法解析它。

XML 在这里:

http://pastebin.com/3HD15Syv

代理类在这里:

http://pastebin.com/M8HP7k9s

我发现了一些奇怪的代码:

    /// <remarks/>
[System.Xml.Serialization.XmlArrayAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
[System.Xml.Serialization.XmlArrayItemAttribute("salesOrder", typeof(responseReturnSalesOrder), Form=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable=false)]
public responseReturnSalesOrder[][] @return {
    get {
        return this.returnField;
    }
    set {
        this.returnField = value;
    }
}
Run Code Online (Sandbox Code Playgroud)

这是我的代码:

StringReader _InXml = new StringReader(responseData);
XmlSerializer _oxs = new XmlSerializer(typeof(response));
response _Response = new response();
_Response = (response)_oxs.Deserialize(_InXml);
Run Code Online (Sandbox Code Playgroud)

c# xml serialization

4
推荐指数
1
解决办法
1193
查看次数

吐司通知失败,模拟器

我在这里使用toast通知示例:

http://code.msdn.microsoft.com/windowsapps/Toast-notifications-sample-52eeba29

当我选择本地机器进行测试时,会出现Toast通知.当我选择模拟器时,我看到的只是XML.我的清单启用了祝酒.我错过了任何步骤吗?

在此输入图像描述

microsoft-metro

3
推荐指数
1
解决办法
493
查看次数

HTTP请求超时Windows Azure部署

我有一个使用WCF服务的MVC 4网站.当我使用VS 2012发布向导部署到Windows Azure时,出现此错误:

10:13:19 AM - 对'https://management.core.windows.net/42d4257b-5f38-400d-aac5-2e7acee9597d/services/hostedservices/myapp?embed-detail=true'的HTTP请求已超出分配超时00:01:00 分配给此操作的时间可能是较长超时的一部分.

清理项目并发布几次后,错误消失了.我究竟做错了什么?

azure

3
推荐指数
1
解决办法
2750
查看次数

无法加载文件或程序集'msshrtmi,系统找不到指定的文件

我正在尝试将Windows Azure网站从云降级到网站.我收到此错误:

无法加载文件或程序集'msshrtmi,Version = 1.7.0.0,Culture = neutral,PublicKeyToken = 31bf3856ad364e35'或其依赖项之一.该系统找不到指定的文件.

[FileNotFoundException:无法加载文件或程序集'msshrtmi,Version = 1.7.0.0,Culture = neutral,PublicKeyToken = 31bf3856ad364e35'或其依赖项之一.系统找不到指定的文件.]
Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment.InitializeEnvironment()+0 Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment..cctor()+546

[TypeInitializationException:'Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment'的类型初始化程序引发异常.]
Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment.GetConfigurationSettingValue(String configurationSettingName)+0
AzureInit.AzureHelper_GetApplicationSettings(String key)+28

[HttpException(0x80004005):'Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment'的类型初始值设定项引发异常.]
System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context,HttpApplication app)+9859725
System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext ,HttpContext上下文,MethodInfo []处理程序)+118
System.Web.HttpApplication.InitSpecial(HttpApplicationState状态,MethodInfo []处理程序,IntPtr appContext,HttpContext上下文)+172
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext,HttpContext context)+ 336
System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext)+296

[HttpException(0x80004005):'Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment'的类型初始值设定项引发异常.] System.Web.HttpRuntime.FirstRequestInit(HttpContext context)+9873912
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context)+101 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr,HttpContext context)+254

因为我不在云中,我需要这个程序集吗?我如何告诉网站不要寻找它?我已将这些引用添加到我的项目中:

Microsoft.WindowsAzure.CloudDrive Microsoft.WindowsAzure.Diagnostics Microsoft.WindowsAzure.ServiceRuntime Microsoft.WindowsAzure.StorageClient

在我的WorkerRole.cs类中,这是我的代码:

/// <summary>
/// Reads settings from service configuration file. 
/// </summary>
/// <param name="key">Setting key.</param>    
string AzureHelper_GetApplicationSettings(string key)
{
    try
    {
        return RoleEnvironment.GetConfigurationSettingValue(key);
    }
    catch
    { …
Run Code Online (Sandbox Code Playgroud)

c# azure azure-web-roles

3
推荐指数
1
解决办法
2898
查看次数