WCF SOAP 404错误

时间:2017-06-08 21:42:55

标签: c# web-services wcf soap wsdl

我开发了WCF SOAP Web服务,出于测试目的,我使用SOAP UI但是我遇到以下问题:

1)我使用ip地址测试Web服务,如下所示:

http://XXX.XXX.XXX.XXX:81/SIDIGE.Web.Service.CanDoc.svc?wsdl

一切正常,我可以毫无问题地使用网络服务

2)现在,如果我像这样测试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>

1 个答案:

答案 0 :(得分:0)

问题不在于我或配置。它是测试客户端(SOAP UI)。它似乎与代理网络有一些问题。