【问题标题】:VS 2010 WCF service reference https connection errorVS 2010 WCF 服务参考 https 连接错误
【发布时间】:2010-12-14 04:42:58
【问题描述】:

在 Visual Studio 2010 中更新 WCF 服务引用时出错:

下载“https://192.16.0.76/MyService.svc”时出错。 请求被中止:无法创建 SSL/TLS 安全通道。 元数据包含无法解析的引用:“https://192.16.0.76/MyService.svc”。 客户端身份验证方案“匿名”禁止 HTTP 请求。 远程服务器返回错误:(403) Forbidden。

两周前参考更新工作正常,web.config 文件中没有任何更改。现在我无法更新服务参考并向 Silverlight 应用程序添加新功能。我在互联网上寻找答案,大多数人建议在开发人员的电脑上检查证书。我的电脑上没有任何证书,我也将任何证书添加到本地机器存储中。也许我应该更改 Visual Studio 的默认证书,但我找不到如何做到这一点。

这是我的 web.config 文件:

  <source name="System.ServiceModel"
      switchValue="Error,Warning"
      propagateActivity="true">
    <listeners>
      <add type="System.Diagnostics.DefaultTraceListener"
              name="Default">
        <filter type="" />
      </add>
      <add name="ServiceModelTraceListener">
        <filter type="" />
      </add>
    </listeners>
  </source>

  <source name="System.ServiceModel.MessageLogging"
  switchValue="Warning, Error">
    <listeners>
      <add type="System.Diagnostics.DefaultTraceListener" name="Default">
        <filter type="" />
      </add>
      <add name="ServiceModelMessageLoggingListener">
        <filter type="" />
      </add>
    </listeners>
  </source>
</sources>

<sharedListeners>

  <add initializeData="tracelog.svclog"
      type="System.Diagnostics.XmlWriterTraceListener, System, 
                    Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
      name="ServiceModelTraceListener" traceOutputOptions="Timestamp">
    <filter type="" />
  </add>
  <add initializeData="messages.svclog"
      type="System.Diagnostics.XmlWriterTraceListener, 
                    System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
      name="ServiceModelMessageLoggingListener" traceOutputOptions="Timestamp">
    <filter type="" />
  </add>
</sharedListeners>

<trace autoflush="true" />

<pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"/>
<httpRuntime executionTimeout="600" />

    </behavior>
  </serviceBehaviors>
</behaviors>
<bindings>
  <customBinding>
    <binding name="MyForm.Web.MyService.customBinding0"
         receiveTimeout="00:10:00" sendTimeout="00:10:00"

           openTimeout="00:10:00" closeTimeout="00:10:00">
      <binaryMessageEncoding/>
      <httpsTransport maxReceivedMessageSize="2147483647" />
    </binding>
  </customBinding>
  <wsHttpBinding>
    <binding name="CertificateWithTransport" 
           receiveTimeout="00:10:00" sendTimeout="00:10:00"
           openTimeout="00:10:00" closeTimeout="00:10:00"
            maxReceivedMessageSize="2147483647">
      <security mode="Transport" >
        <transport clientCredentialType="Certificate"  />
      </security>
      <readerQuotas maxDepth="2640000"
               maxStringContentLength="2000000000"
               maxArrayLength="2000000000"
               maxBytesPerRead="2000000000"
               maxNameTableCharCount="2000000000" />
    </binding>
  </wsHttpBinding>
</bindings>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true"/>
<services>
  <service behaviorConfiguration="ServiceBehavior" name="MyForm.Web.MyService">
    <endpoint address="" binding="wsHttpBinding" bindingConfiguration="CertificateWithTransport"
      contract="MyForm.Web.MyService" />
  </service>
</services>
<diagnostics >
  <messageLogging logMalformedMessages="true"             
   logMessagesAtServiceLevel="true"
   logMessagesAtTransportLevel="true" 
    />
</diagnostics>

任何帮助将不胜感激。

[Upd] 好像是我电脑上的证书问题引起的。如何选择将用于 https 连接到 Web 服务的证书?我在互联网上找到了类似的topics,但没有解决方案。

【问题讨论】:

    标签: wcf visual-studio-2010 certificate


    【解决方案1】:

    通过WCF – 2 Way SSL Security using Certificates,可能会对您有所帮助。

    【讨论】:

    • 我读过那篇文章。它包含有关为 WCF 配置 SSL 的信息。但是我已经配置好了。 Silverlight 应用程序连接到 WCF 没有问题,但 Visual Studio 无法更新服务引用。
    猜你喜欢
    • 2015-07-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-12-24
    • 1970-01-01
    • 1970-01-01
    • 2020-01-12
    • 1970-01-01
    相关资源
    最近更新 更多