我不得不将我在控制台应用程序上运行的wcf服务更改为https,原因是"混合内容阻止"在Firefox中。
这是配置:
<services>
<service name="ServiceHost.Services.BiometricCaptureService" behaviorConfiguration="Default">
<endpoint address="rest" behaviorConfiguration="CorsBehavior" binding="webHttpBinding" bindingConfiguration="httpsBinding" contract="ServiceHost.IServices.IBiometricCaptureService"/>
<endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="https://localhost:8502/biometrics/biometricscaptureservice.svc"/>
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<endpointBehaviors>
<behavior name="CorsBehavior">
<webHttp/>
<crossOriginResourceSharingBehavior/>
</behavior>
</endpointBehaviors>
<serviceBehaviors>
<behavior name="Default">
<serviceMetadata httpGetEnabled="false" httpsGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
</serviceBehaviors>
</behaviors>
<extensions>
<behaviorExtensions>
<add name="crossOriginResourceSharingBehavior" type="ServiceHost.Utility.CORSBehaviorExtensionElement, ServiceHost, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"/>
</behaviorExtensions>
</extensions>
<bindings>
<webHttpBinding>
<binding name="httpsBinding" maxReceivedMessageSize="2147483647">
<security mode="Transport">
<transport clientCredentialType="None" proxyCredentialType="None" realm="" />
</security>
<readerQuotas maxStringContentLength="2147483647" />
</binding>
</webHttpBinding>
</bindings>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>
使用此配置启动服务不会引发任何错误,但我无法再点击端点。
我能得到的唯一错误是:&#34;无法从传输连接中读取数据:远程主机强行关闭现有连接。&#34;
任何人都可以看到这个问题吗?
答案 0 :(得分:1)
我不知道您的服务将如何找到加密证书。
你应该有这样的东西:
<behaviors>
<serviceBehaviors>
<behavior name="mySvcBehavior">
<serviceCredentials>
<serviceCertificate findValue="xxxxxx" x509FindType="FindByThumbprint" />
</serviceCredentials>
</behavior>
</serviceBehaviors>
</behaviors>
这是在WCF网站上设置HTTPS的相当不错的分步指南。 http://robbincremers.me/2011/12/27/wcf-transport-security-and-client-certificate-authentication-with-self-signed-certificates/