0
我已經開發了一個WCF SOAP的Web服務和測試的目的,我使用SOAP UI,但我有以下問題:WCF SOAP 404錯誤
1)我使用IP地址這樣的測試Web服務:
http://XXX.XXX.XXX.XXX:81/SIDIGE.Web.Service.CanDoc.svc?wsdl
,一切工作正常,我可以毫不問題
2)使用Web服務現在,如果我測試這樣的Web服務(使用主機名):
http://hp_webserver:81/SIDIGE.Web.Service.CanDoc.svc?wsdl
我得到一個404錯誤,當我發佈信息到服務器(如果我使用的瀏覽器,鍵入工作的地址,沒有404錯誤)
我讀過有關這一點,並沒有所有問題似乎工作....任何想法?
我的web.config是:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<connectionStrings>
<add name="servidorRemoto" connectionString="Data Source=XXX\XXX; Initial Catalog=XXX" providerName="System.Data.SqlClient" />
</connectionStrings>
<appSettings>
<add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
</appSettings>
<system.web>
<compilation debug="true" />
</system.web>
<!-- When deploying the service library project, the content of the config file must be added to the host's
app.config file. System.Configuration does not support config files for libraries. -->
<system.serviceModel>
<services>
<service name="SIDIGE.Web.Service.CanDoc" behaviorConfiguration="ServiceBehavior">
<endpoint address="CanDoc" binding="basicHttpBinding" contract="SIDIGE.Web.IService.ICanDoc" bindingNamespace="http://sidige.com/candoc" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://XXX.XXX.XXX.XXX:81" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="ServiceBehavior">
<serviceMetadata httpGetEnabled="True" httpsGetEnabled="True" />
<serviceDebug includeExceptionDetailInFaults="True" />
<useRequestHeadersForMetadataAddress>
<defaultPorts>
<!-- Use your own port numbers -->
<add scheme="http" port="81" />
</defaultPorts>
</useRequestHeadersForMetadataAddress>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
<system.webServer>
<directoryBrowse enabled="false" />
</system.webServer>
</configuration>
在測試第二種方案時,是否更改web.config中的'baseAddress'? – tomassino
不,我沒有(我有另一臺服務器,這兩種情況下工作正常) – Pedro
如果您在IIS上託管您的服務,基地址由IIS Virutal目錄和.svc文件確定。我會說你不需要在你的配置文件中使用基地址元素。它將由IIS確定 –