简体   繁体   English

环回连接在Windows Server 2008上不起作用

[英]Loopback connections not working on Windows Server 2008

I am using Windows Server 2008 R2 with IIS 7. My MVC application runs fine on asp.net 4.5 version. 我正在使用带有IIS 7的Windows Server 2008 R2。我的MVC应用程序在asp.net 4.5版本上运行正常。 Note that application works fine on other servers and hosting accounts. 请注意,应用程序适用于其他服务器和托管帐户。

However, on one of the new system... only one of the function is not working and I'm getting an error trying to run another function from application by making an http call! 但是,在一个新系统上...只有一个功能不起作用,我在尝试通过进行http调用从应用程序运行另一个函数时出错!

This works fine on other all other hosting accounts (on different server) / on shared server too and development machine. 这适用于其他所有其他主机帐户(在不同的服务器上)/共享服务器上和开发机器。 Not sure why on this new windows 2008 server with IIS its not working. 不知道为什么在这个带有IIS的新Windows 2008服务器上它无法正常工作。

I am getting (404) Not Found error when application tries to call this URL. 当应用程序尝试调用此URL时,我收到(404)Not Found错误。

If I call the function manually, it runs.. but I need to call this function in certain event by making an http call within application. 如果我手动调用该函数,它会运行..但我需要在某个事件中通过在应用程序中进行http调用来调用此函数。 This is a loopback connection originating from application to the same application but another function called at different url with parameters. 这是一个环回连接,源自应用程序到同一个应用程序,但另一个函数在不同的url中调用带参数。

Can anyone advise what could be wrong here? 任何人都可以建议这里可能有什么问题吗? And what thing we need to fix to enable loopback connections support in IIS / server? 我们需要修复什么才能在IIS /服务器中启用环回连接支持?

Here is the code that is used. 这是使用的代码。

HttpWebRequest objRequest = (HttpWebRequest)WebRequest.Create(url);
objRequest.Method = "GET";
objRequest.ContentType = "application/x-www-form-urlencoded";
objRequest.AllowAutoRedirect = true;

ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(AcceptAllCertifications);

Awaiting your quick response on the same. 等待你的快速反应。

The issue was with the mapping of the domain in Server. 问题在于Server中域的映射。 When trying to open the domain from external network, it serves the website correctly. 尝试从外部网络打开域时,它正确地为网站提供服务。 But when I tried to open on the browser on the same server it wasn't serving the request. 但是,当我尝试在同一台服务器上的浏览器上打开时,它没有提供请求。

I added the domain name entry to the windows hosts file and resolved it to 127.0.0.1, then it started to work fine. 我将域名条目添加到Windows主机文件并将其解析为127.0.0.1,然后它开始正常工作。

Thank you everyone for your efforts in helping me fixing the issue. 感谢大家帮助我解决问题的努力。 Without your inputs I might not be able to fix this. 没有你的输入,我可能无法解决这个问题。 The credit is all yours, but as there was no answer I created an answer for helping other who faces same issue. 信誉是你的全部,但由于没有答案,我创建了一个答案,帮助其他面临同样问题的人。

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

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