我在Visual Studio 2010中更新WCF服务引用时遇到错误:
下载' https://192.16.0.76/MyService.svc'时出错。 请求已中止:无法创建SSL / TLS安全通道。 元数据包含无法解析的引用:' https://192.16.0.76/MyService.svc'。 客户端身份验证方案' Anonymous'禁止HTTP请求。 远程服务器返回错误:(403)禁止。
两周前参考更新工作正常,web.config文件中没有任何更改。现在,我无法更新服务引用并向Silverlight应用程序添加新功能。我在互联网上寻找答案,大多数人建议在开发者的电脑上查看证书。我没有通过我的电脑获得任何证书,我也将ny证书添加到本地机器商店。也许我应该更改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>
任何帮助将不胜感激。
[更新]它似乎可能是由我的电脑上的证书问题引起的。如何选择将用于https连接到Web服务的证书?我在互联网上发现了类似的topics,但没有解决方案。