我想讓https安全工作爲我在IIS 7.5託管的wcf Web服務工作。我瀏覽了每一篇關於這方面可以在網上找到的文章,並且嘗試了幾乎所有可以找到或變化的配置或IIS技巧。我認爲這可能是一個IIS,Windows級別的配置問題。我們正在使用通配符SSL證書,如* .mycompany.com。如果有任何方位,此證書已在其他3個已在同一IIS中的網站上使用。有誰知道我在這裏遇到什麼?這是一個公共服務器,非TEST和http綁定工作正常。我在我的開發和生產服務器上有這個相同的https問題。我們在這個生產箱上有另一個https網站,它發送和接收數據都很好。我得到異常:獲取404沒有端點偵聽錯誤WCF 4.0使用Https basicHttpBinding在傳輸安全
There was no endpoint listening at https://subdomain.mydomain.com/MyService.svc that could accept the message. This is often caused by an incorrect address or SOAP action.
Inner Exception :
The remote server returned an error: (404) Not Found.
這裏是我的web.config
:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<appSettings file="LocalAppSettings.config">
<!--<add key="CustomIISServiceHostEndPoint" value="https://subdomain.mydomain.com/MyService.svc" />-->
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.0" />
<customErrors mode="Off" />
</system.web>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="COLWebServiceBinding" maxReceivedMessageSize="134217727" sendTimeout="00:03:00" receiveTimeout="00:03:00">
<security mode="Transport">
<transport clientCredentialType="None" />
</security>
<readerQuotas maxArrayLength="65536" maxBytesPerRead="65536" maxStringContentLength="134217727" />
</binding>
</basicHttpBinding>
</bindings>
<services>
<service behaviorConfiguration="COLWebService.ServiceBehavior" name="COLWebService">
<endpoint address="https://subdomain.mydomain.com/MyService.svc"
binding="basicHttpBinding"
contract="MyCompany.COLWebService.ICOLWebService"
bindingConfiguration="COLWebServiceBinding" />
<endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" />
</service>
</services>
<extensions>
<behaviorExtensions>
<add name="errorHandler" type="MyCompany.COLWebService.ErrorHandlerBehaviorExtensionElement, MyCompany.COLWebService" />
</behaviorExtensions>
</extensions>
<behaviors>
<serviceBehaviors>
<behavior name="COLWebService.ServiceBehavior">
<serviceMetadata httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
<!--<behavior name="">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>-->
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="false">
</serviceHostingEnvironment>
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
</system.webServer>
</configuration>
這裏是我的客戶的app.config
:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="wsHttpBinding_ICOLWebService" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:03:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="524288" maxReceivedMessageSize="134217727"
messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true">
<readerQuotas maxStringContentLength="134217727" maxArrayLength="65536"
maxBytesPerRead="65536" />
<security mode="Transport">
<transport clientCredentialType="None" proxyCredentialType="None" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="https://subdomain.mydomain.com/MyService.svc"
binding="basicHttpBinding" bindingConfiguration="wsHttpBinding_ICOLWebService"
contract="COLWebService.ICOLWebService" name="wsHttpBinding_ICOLWebServiceEP" />
</client>
</system.serviceModel>
</configuration>
您是否嘗試過剛剛打開瀏覽器並導航到SVC地址?我經常發現比試圖解決WCF錯誤更多的信息。 – 2012-03-23 17:46:49
是的,如果我只有https綁定它似乎導航好,但MEX關閉,即使我已打開配置文件中的MEXHttps。但它應該在有或沒有mex的情況下工作。 – kyleb 2012-03-23 18:57:25
我認爲這可能是因爲我使用UI來爲每個站點分配通配符證書,而不是使用命令行。不,我去了,並刪除了所有我的網站上的所有https綁定,然後將它們全部綁定到https,使用本站告訴我的命令行使用相同的通配符證書。 http://www.sslshopper.com/article-ssl-host-headers-in-iis-7.html。就像這個appcmd set site /site.name:「」/+bindings.[protocol='https',bindingInformation ='*:443:'] –
kyleb
2012-03-26 02:07:19