Roc*_*ngh 4 c# asp.net windows-7 iis-7.5
在以以下URL运行的Visual Studio中进行调试时,http://localhost:39452/
我得到http://127.0.0.1以下属性的值
HttpContext.Current.Request.Url
Run Code Online (Sandbox Code Playgroud)
而不是http://localhost:39452/
在我的主机文件中具有此值:
::1 localhost
Run Code Online (Sandbox Code Playgroud)
你可以让我在这里做错什么吗?
小智 5
也许您试图HttpContext.Current.Request.Url过早获得价值。
例如; 在Init发生事件的过程中,HttpModule您可能会遇到此类问题。我的意思是您可能会得到http://127.0.0.1/myApp而不是的正确值http://localhost/myApp。