在Web应用程序中调用Web服务“无法连接到远程服务器”,但在控制台应用程序中可以正常

时间:2013-09-19 11:20:48

标签: c# asp.net web-services web-applications console-application

我有一种非常奇怪的行为。我有一个ASP.NET 3.0控制台应用程序,它调用web服务来发送短信。

我正在尝试在ASP.NET 4.0 Web应用程序中复制相同的东西但是当我调用webservice时,当我调用发送sms的方法时,它会给我一个错误:

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

InnerException 无法连接到远程服务器

InnerException.Message 连接尝试失败,因为连接方在一段时间后没有正确响应,或建立连接 失败,因为已连接的主机无法响应webserviceIP:80

我在展位网站和控制台应用程序中使用完全相同的代码和完全相同的配置:

var soap = new Service.WebServicesSoapClient();
soap.SendSMS(smsUser, smsPassword, number, message, originator);

-

  <system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding name="WebServicesSoap" />
      </basicHttpBinding>
    </bindings>
    <client>
      <endpoint address="webservice.asmx" binding="basicHttpBinding" bindingConfiguration="WebServicesSoap" contract="Service.WebServicesSoap" name="WebServicesSoap" />
    </client>
  </system.serviceModel>

有什么阻止我的网络应用程序的想法吗?

提前致谢。

0 个答案:

没有答案