[英]Trouble adding service reference to WCF service hosted in IIS Express with SSL
I have a plain WCF service hosted in IIS Express in Visual Studio 2010. IIS Express is configured to use SSL. 我在Visual Studio 2010中的IIS Express中托管了一个普通的WCF服务.IIS Express配置为使用SSL。
Before switching to SSL, I had no problems, but now I cannot update are add a service reference to my WCF Service (which is just a normal IIS hosted svc file). 在切换到SSL之前,我没有遇到任何问题,但现在我无法更新是为我的WCF服务添加服务引用(这只是一个普通的IIS托管的svc文件)。
When I use the WCFTestClient, I get a little more useful error: 当我使用WCFTestClient时,我得到一个更有用的错误:
Error: Cannot obtain Metadata from https://localhost:44302/Services/TrueChecksService.svc If this is a Windows (R) Communication Foundation service to which you have access, please check that you have enabled metadata publishing at the specified address.
错误:无法从https:// localhost:44302 / Services / TrueChecksService.svc获取元数据如果这是您有权访问的Windows(R)Communication Foundation服务,请检查您是否已在指定地址启用元数据发布。 For help enabling metadata publishing, please refer to the MSDN documentation at http://go.microsoft.com/fwlink/?LinkId=65455 .WS-Metadata Exchange Error URI: https://localhost:44302/Services/TrueChecksService.svc Metadata contains a reference that cannot be resolved: 'https://localhost:44302/Services/TrueChecksService.svc'.
有关启用元数据发布的帮助,请参阅MSDN文档, 网址为http://go.microsoft.com/fwlink/?LinkId=65455 .WS-元数据交换错误URI: https:// localhost:44302 / Services / TrueChecksService.svc元数据包含无法解析的引用:'https:// localhost:44302 / Services / TrueChecksService.svc'。 Could not establish trust relationship for the SSL/TLS secure channel with authority 'localhost:44302'.
无法与权限“localhost:44302”建立SSL / TLS安全通道的信任关系。 The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.
底层连接已关闭:无法为SSL / TLS安全通道建立信任关系。 The remote certificate is invalid according to the validation procedure.HTTP GET Error URI: https://localhost:44302/Services/TrueChecksService.svc There was an error downloading 'https://localhost:44302/Services/TrueChecksService.svc'.
根据验证程序,远程证书无效.HTTP GET错误URI: https:// localhost:44302 / Services / TrueChecksService.svc下载“https:// localhost:44302 / Services / TrueChecksService.svc”时出错。 The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.
底层连接已关闭:无法为SSL / TLS安全通道建立信任关系。 The remote certificate is invalid according to the validation procedure.
根据验证程序,远程证书无效。
Here's my config at the moment: 这是我目前的配置:
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
<bindings>
<basicHttpBinding>
<binding name="MyBasicHttpBindingConfig" receiveTimeout="00:15:00"
sendTimeout="00:15:00" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
<security mode="Transport" />
</binding>
</basicHttpBinding>
</bindings>
<services>
<service name="TrueChecksService" behaviorConfiguration="TrueChecksServiceBehavior">
<endpoint binding="basicHttpBinding" bindingConfiguration="MyBasicHttpBindingConfig"
name="TrueChecksServiceEndpoint" contract="TrueChecksAdminSL.Web.Services.ITrueChecksService" />
<endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="TrueChecksServiceBehavior">
<useRequestHeadersForMetadataAddress>
<defaultPorts>
<add port="44302" scheme="https"/>
</defaultPorts>
</useRequestHeadersForMetadataAddress>
<serviceMetadata httpGetEnabled="false" httpsGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
Do I need to write a custom certificate validator, since IIS Express generates a self-signed certificate? 我是否需要编写自定义证书验证程序,因为IIS Express会生成自签名证书? I was trying to solve without doing that because when I deploy to IIS, the site will be configured with a certificate issued by a certificate authority.
我试图解决这个问题,因为当我部署到IIS时,该站点将配置一个由证书颁发机构颁发的证书。
Thanks for any help. 谢谢你的帮助。
Browse the URL from IE. 从IE浏览URL。 You would see the warning that there is a problem with the website's security certificate.
您会看到网站安全证书存在问题的警告。 Follow the steps in what-do-i-need-to-do-to-get-ie8-to-accept-a-self-signed-certificate .
按照“ 我需要做什么”来获取ie8接受自签名证书的步骤 。 When that is successful and you can get to the site without getting that warning in IE, the WCFClient would also be able to get to it.
如果成功并且您可以在IE中未获得该警告的情况下访问该站点,WCFClient也可以访问它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.