简体   繁体   English

发布后在MVC项目上使用WCF失败

[英]consuming wcf on mvc project fails after published

I'm using a sms panel in my website which provides me with a api to use, when I'm debugging the system and use it locally it works perfectly but when I publish the website it gives the following error: 我在网站上使用的短信面板为我提供了一个要使用的api,当我调试系统并在本地使用它时,它可以正常工作,但是当我发布网站时,出现以下错误:

A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 87.107.121.54:80

and this is the code I'm using 这是我正在使用的代码

SendSoapClient client = new SendSoapClient("SendSoap");
ArrayOfString receivers = new ArrayOfString();
receivers .Add("0920xxxxxxx");
ArrayOfString result = client.SendSimpleSMS("username", "password", receivers, "sender number", "message goes here", false);

I've put the call to the web service inside my global.asax file just to check if it works or not and it just doesn't work. 我已将对Web服务的调用放在我的global.asax文件中,只是为了检查它是否有效,以及它是否无效。 what exactly am I doing wrong here ? 我到底在做什么错?

PS: I've used this api service in my other websites which are not mvc projects, but just asp.net website and they all are working fine, this is the first time using it in mvc project. PS:我已经在其他非mvc项目的网站中使用了此api服务,而只是asp.net网站,它们都工作正常,这是第一次在mvc项目中使用它。

It appears that the computer you deployed your application to doesn't have network access to the 87.107.121.54 IP address which is where the API is hosted. 看来您将应用程序部署到的计算机没有网络访问API所在的87.107.121.54 IP地址。 So talk to your network administrator and make sure that the server on which your ASP.NET MVC application is running has network access to this address. 因此,请与您的网络管理员联系,并确保运行ASP.NET MVC应用程序的服务器具有对该地址的网络访问权限。 Since it is on port 80, I suppose that there shouldn't be issues with the firewall, but nevertheless, you should check that as well. 由于它位于端口80上,因此我认为防火墙应该不会出现问题,但是您也应该检查一下。 There's nothing wrong with your code, it's more of an infrastructure and network connectivity problem. 您的代码没有错,更多的是基础架构和网络连接问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM