2011-04-18 93 views
5

我在Visual Studio 2010中的IIS Express在IIS快递主办的纯WCF服务WCF服务配置为使用SSL。无法添加服务引用在IIS快递托管与SSL

切换到SSL之前,我没有问题,但现在我不能更新是添加一个服务引用到我的WCF服务(这仅仅是一个正常的IIS托管SVC文件)。

当我使用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. 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'. Could not establish trust relationship for the SSL/TLS secure channel with authority 'localhost:44302'. The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel. 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'. The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel. The remote certificate is invalid according to the validation procedure.

这里是我的配置在当下:

<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> 

我是否需要写一个自定义证书验证程序,因为IIS Express生成自签名证书?我试图在没有这样做的情况下解决问题,因为当我部署到IIS时,站点将配置证书颁发机构颁发的证书。

感谢您的任何帮助。

回答

3

从浏览IE的URL。您会看到网站安全证书存在问题的警告。按照what-do-i-need-to-do-to-get-ie8-to-accept-a-self-signed-certificate中的步骤操作。如果这是成功的,你可以得到该网站没有得到在IE的警告,该WCFClient也将能够得到它。

+0

更具体地说,从以下这个答案在amit_g指出到后这些方向。 http://stackoverflow.com/a/1412118/83658 – jpierson 2012-03-01 21:49:07