Click here to Skip to main content
13,045,019 members (39,194 online)
Rate this:
Please Sign up or sign in to vote.
See more:
I am using one rest service in my application. when I run the solution everything working fine
but when I publish the solution and browse it throwing the below error.

What all I tried ,

1. added below code in web.config
      <defaultProxy enabled="true" useDefaultCredentials="true">
      <proxy usesystemdefault="True"/>  

2. on internet tool added into trusted site the url
3. whet to proxy at internet tools and bypassed it with\*
still no use, could you please help.

code which is used in application is below,

string   CallOriginMethod()  
                string uri = "";
                string Method = "POST";
            HttpWebRequest req = WebRequest.Create(uri) as HttpWebRequest;
            req.KeepAlive = false;
            req.Method = Method.ToUpper();
            if (("POST,PUT").Split(',').Contains(Method.ToUpper()))
                string stringxml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
   " <GlobalrateoriginRequest xmlns:xsi=\"\" xsi:noNamespaceSchemaLocation=\"WWA_Rate_Lookup_origins_request_version_2.0.1.xsd\">" +
  "<GlobalrateoriginEnvelope><SenderID>test_agility</SenderID><ReceiverID>restapi</ReceiverID><Password>01870fa4b08a1</Password><Type>Globalrate_Origin_Request</Type> " +
     "<Version>2.0.1</Version><EnvelopeID>123</EnvelopeID></GlobalrateoriginEnvelope><GlobalrateoriginRequestDetails><Date>2013-04-25</Date><Customeralias>AGILITY</Customeralias>" +
                byte[] buffer = Encoding.ASCII.GetBytes(stringxml);
                req.ContentLength = buffer.Length;
                req.ContentType = "text/xml";
                Stream PostData = req.GetRequestStream();
                PostData.Write(buffer, 0, buffer.Length);
               // declare & read response from service
            HttpWebResponse resp = req.GetResponse() as HttpWebResponse;
               // set utf8 encoding       
               Encoding enc = System.Text.Encoding.GetEncoding(1252);     
                   // read response stream from response object    
               StreamReader loResponseStream = new StreamReader
                   (resp.GetResponseStream(), enc);
               String strResult = string.Empty;
               // read string from stream data    
               strResult = loResponseStream.ReadToEnd();      
               // close the stream object    
               // close the response object   
               return strResult;

that method we are calling on page load as below

var docs = XElement.Parse(CallOriginMethod());
Posted 5-May-13 22:30pm
Prasad Khandekar 6-May-13 6:21am
Does running ping from command prompt returns response similar to one shown below.

Pinging [] with 32 bytes of data:

Reply from bytes=32 time=817ms TTL=51
Reply from bytes=32 time=256ms TTL=51
Reply from bytes=32 time=256ms TTL=51
Reply from bytes=32 time=256ms TTL=51

Ping statistics for
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 256ms, Maximum = 817ms, Average = 396ms

It's seems to be a problem with NAME resolution. Contact your IT team and check with them.

ryanb31 6-May-13 10:25am
That's a weird way, in my opinion, to have a url. Shouldn't it just be Why the extra www and in the middle of the url?

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Dear All, Thank you for your reply. I got the solution.

The issue was, when i deployed on IIS , I could have pass my account details, which i haven't done and that was not allowing me to browse the url.

Please reach me anytime for detailed info, if not clear.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170713.1 | Last Updated 9 May 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100