无法下载元数据WCF服务

时间:2018-06-16 17:49:32

标签: wcf networking

我有一个WCF类库,其配置如下

<system.serviceModel>
<services>
    <service name="Namespace.Service">
        <host>
            <baseAddresses>
                <add baseAddress = "http://xxx.xxx.43.84:8731/service/" />
            </baseAddresses>
        </host>
        <endpoint address="" binding="basicHttpBinding" contract="Namespace.Interface">
            <identity>
                <dns value="localhost"/>
            </identity>
        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
    </service>
</services>
<behaviors>
    <serviceBehaviors>
        <behavior>
            <serviceMetadata httpGetEnabled="True"/>
            <serviceDebug includeExceptionDetailInFaults="False" />
        </behavior>
    </serviceBehaviors>
</behaviors>
</system.serviceModel>

地址是我在Windows中的WIFI状态中找到的IP地址。当我使用测试客户端运行项目时,我可以在本地计算机上访问它并在浏览器中查看它。我有另一台机器连接到同一个WIFI,我试图从那里获得服务。

我在第二台机器上添加了一个项目的服务引用,其地址如下:

"http://xxx.xxx.43.84:8731/service/"

首先它给了我一个超时所以在看完网上之后我发现我需要在端口8731上运行服务的机器上的防火墙上添加一个入站规则。我做了它而我得到了另一个错误:

There was an error downloading 
'http://xxx.xxx.43.84:8731/service/$metadata'.
The request failed with HTTP status 404: Not Found.
Metadata contains a reference that cannot be resolved: 
'http://xxx.xxx.43.84:8731/service/'.
There was no endpoint listening at http://xxx.xxx.43.84:8731/service/ 
that could accept the message. This is often caused by an incorrect address 
or SOAP action. See InnerException, if present, for more details.
The remote server returned an error: (404) Not Found.
If the service is defined in the current solution, try building the solution 
and adding the service reference again.

我做错了什么?

0 个答案:

没有答案