在“.svc”上没有可以接受该消息的端点

问题描述 投票:1回答:1

连接到WCF Web服务时出现异常。

我在我的项目中将此Web服务添加为服务引用。

地址是http://192.168.16.91:8092/ws_merchants.svc和wsdl地址http://192.168.16.91:8092/ws_merchants.svc?wsdl

app.config中,我有这个绑定配置:

<system.serviceModel>
    <bindings>
        <basicHttpBinding>
            <binding name="BasicHttpBinding_Iws_Merchants" />
        </basicHttpBinding>
    </bindings>
    <client>
        <endpoint name="BasicHttpBinding" 
            address="http://192.168.16.91:8092/ws_merchants.svc"
            binding="basicHttpBinding"  
            bindingConfiguration="BasicHttpBinding_Iws_Merchants"
            contract="ServiceReferenceSahand.Iws_merchants" />
    </client>
</system.serviceModel>

我使用此服务的代码:

private bool GetToken()
{
    try
    {
        Iws_merchantsClient def = new Iws_merchantsClient();
        var res = def.get_Token("user", "pass");
    }
    catch (Exception ex)
    {
        return false;
    }
}

我得到这个例外:

http://192.168.16.91:8092/ws_merchants.svc没有可以接受该消息的端点。 这通常是由错误的地址或SOAP操作引起的。 有关更多详细信息,请参阅InnerException(如果存在)。

并在内部例外:

远程服务器返回错误:(404)Not Found。

当我从wsdl添加此方法作为服务引用时,找不到什么?

c# asp.net web-services wcf wsdl
1个回答
1
投票

我想你的wsdl文件有问题。您可以检查您的客户端配置文件,看看端点地址是否正确。它有点棘手。并且可能由很多原因引起。我建议你开始跟踪wcf测试客户端的问题。如果你能找到任何东西,请告诉我。

© www.soinside.com 2019 - 2024. All rights reserved.