我想創建一個WCF Web服務,它將允許其他應用程序通過向此服務URL發出http請求來檢索字符串。我試圖發佈在IIS服務和嘗試瀏覽到它的時候,使用的URL,它說,它WCF web服務部署後不工作
' The resource cannot be found'
,當我檢查的路徑,我使用的URL, 的文件夾和我得到的錯誤
'No protocol binding matches the given address
'http://localhost:xxxx/WcfSampleLibrary/Service1/mex.'
Protocol bindings are configured at the Site level in IIS or WAS configuration'
這裏是發佈的文件夾的目錄路徑:
C:\inetpub\wwwroot\WcfServices\WcfSampleLibrary\WcfSampleLibrary.Service1
C:\inetpub\wwwroot\WcfServices\WcfSampleLibrary\Web.config
C:\inetpub\wwwroot\WcfServices\WcfSampleLibrary\bin\WcfSampleLibrary.dll
的網絡配置文件:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.web>
<compilation debug="true" />
</system.web>
<system.serviceModel>
<services>
<service name="WcfSampleLibrary.Service1" behaviorConfiguration ="mex">
<host>
<baseAddresses>
<add baseAddress = "http://192.xxx.x.xxx/WcfSampleLibrary/Service1/" />
</baseAddresses>
</host>
<!-- Service Endpoints -->
<endpoint address =""
binding="wsHttpBinding" contract="WcfSampleLibrary.IService1">
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<!-- Metadata Endpoints -->
<endpoint address="http://localhost:xxxx/WcfSampleLibrary/Service1/mex" name="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="mex">
<serviceMetadata httpGetEnabled="false"/>
<!-- To receive exception details in faults for debugging purposes,
set the value below to true. Set to false before deployment
to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
您在同一臺機器上將它發佈到IIS並設置爲偵聽端口'xxxx'? – mellamokb 2012-04-27 13:46:02
您的baseAddress與您的服務端點地址不同。通常你可以一起省略baseAddress。 – Filburt 2012-04-27 13:49:46
我沒有設置端口,但只想使用服務器的IP地址;它設置端口本身 – vbNewbie 2012-04-27 13:50:24