asp.net - ASP - running in localhost - unable to reach internet -


I have ASP MVC controller action I am trying to make a web request

  Public Action Index () {WebRequest Request = HttpWebRequest.Create ("http://www.example.com"); WebResponse response = Request GetResponse (); String str = response.ToString (); } "I get" WebException occured "" Remote name can not be solved: 'www.example.com'  

If I start Fiddler , Then the WebRest works.

I tried to add:

  > & lt; defaultProxy & gt; & lt; proxy Utility systemdefault = "True" Bypassonlocal = "True" />  

web.config (with HT bypasspointlocals and Without it) and it still does not work.

Any suggestions?

Try to clearly specify the server:

  & lt; system.net & gt; DefaultProxy & gt; & lt; proxy proxyrace = "http: // proxy .yourcompany.com: 80 "/> & lt; / defaultProxy & gt; & lt; /system.net>  

You can also set a proxy program:

  request.Proxy = new WebProxy ("http://proxy.yourcompany.com:80", true);  

When you use usesystemdefault to true , the application uses the proxy defined in the Internet Options dialog box. When you deploy your application in IIS, it usually executes under the network service account, which has very limited rights, there is no GUI session in it, so it is a proxy server Can not guess.


Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -