Web Service Error : The remote server returned an error: (500) Internal Server Error

Hi i am getting an error when trying a simple web service. if i run both the web service and the client .aspx page on the same server it works fine, But when i put it on a different server it doesnt work at all and gives me this error

"System.Net.WebException: The remote server returned an error: (500) Internal Server Error. at System.Net.HttpWebRequest.GetResponse() at HttpUtils.HttpPost(String URI, String Parameters) in e:\Websites\C#\Live\CMS\Trunk\App_Code\siteFunctions\HttpUtils.cs:line 35"

UserApi.asmx

 

    [WebMethod]
    public string HelloName(string name)
    {
        return "Hello " + name;
    }

  

HttpUtils.cs

 

1    using System.Net;
2    using System.IO;
3    
4    /// <summary>
5    /// Summary description for HttpUtils
6    /// </summary>
7    public class HttpUtils
8    {
9        public static string Errors { get; set; }
10   
11       public static string HttpPost(string URI, string Parameters)
12       {
13           Errors = null;
14           WebRequest req = WebRequest.Create(URI);
15           req.ContentType = "application/x-www-form-urlencoded";
16           req.Method = "POST";
17           byte[] bytes = System.Text.Encoding.ASCII.GetBytes(Parameters);
18           Stream output = null;
19           try
20           {
21               req.ContentLength = bytes.Length;//Get the Lenght
22               output = req.GetRequestStream();//Get the  Stream
23               output.Write(bytes, 0, bytes.Length);//Push out the Stream
24           }
25           catch (WebException ex)
26           {
27               Errors += ex.ToString();
28           }
29           finally
30           {
31               if (output != null) output.Close();//Close the Stream
32           }
33           try
34           {
35               WebResponse resp = req.GetResponse();
36               if (resp == null) return null;
37               StreamReader input = new StreamReader(resp.GetResponseStream());
38               return input.ReadToEnd().Trim();
39           }
40           catch (WebException ex)
41           {
42               Errors += "\n" + ex.ToString();
43               return null;
44           }
45       }
46   }
47   
test.aspx
  
1    public partial class test : System.Web.UI.Page
2    {
3        protected void Page_Load(object sender, EventArgs e)
4        {
5            Response.Write(HttpUtils.HttpPost("http://domainname.co.uk/userapi.asmx/HelloName", "name=dan"));
6            Response.Write("<br/>Errors:" + HttpUtils.Errors);
7        }
8    }
 
 
Anyone got any idea?
 
Thanks dan 
  
0
Capture_db
4/2/2009 7:32:52 PM
asp.net.xml-web-services 7071 articles. 0 followers. Follow

6 Replies
9036 Views

Similar Articles

[PageSpeed] 10

Yes, I believe the issue is security. I think by default you cannot make cross-domain web service calls.

Try googling "clientaccesspolicy.xml" and that may shed some light on how to do the cross-domain WS calls.


jameswright
www.jwright.info

"Never be so busy making a living that you forget to make a life."
0
jameswright
4/3/2009 4:06:04 AM

 Hello,

Check your proxy settings, you can not have rights to access urls of that particular server, can you run

other urls of that server? If not then ask to system admin for rights or can change proxy from your IE and mozilla

and check again.


Thanks,

Mark as Answer if it helps u....

Devaang
0
Devaang
4/3/2009 4:30:07 AM
Hi, I think you should put a complete SOAP request in the content part of your HttpWebRequest and also add a SOAPAction parameter to the header of your request. Try to log SOAP messages on the service side to check if your request is a valid request or not since this error shows that the service receives your request but can not answer to it.
0
baaroon
4/3/2009 5:55:58 AM

Hi,

Add following tags in Web.config file and try again.

<webServices> <protocols> <add name="HttpGet"/>

<add name="HttpPost"/>

</protocols> </webServices>

 

 


(If this post is helpful, please mark as an answer )

Regards,

Prajeesh
Web Developer
ipix solutions
My Blog:Prajeesh's Tech blog
My company :IPIX Solutions
0
prajeeshkkindia
4/3/2009 9:47:38 AM

Can you browse the asmx page (webservice) directory without aspx.

Check event viewer you might get more information on the reason of the 500 error.

Go to run -> type eventvwr


Please mark it as answer if it resolves the issue.

visit: http://technicalsol.blogspot.com
0
sumitd
4/3/2009 10:41:15 AM

When the remote server returns an error, then it means that the remote server noticed something bad. When the error is 500, that means it's an internal error, meaning internal to the service - the service threw an exception that was not caught.

Look in the Windows event logs on the service to see what went wrong.


John Saunders | MVP – Connected System Developer
0
johnwsaunders3
4/3/2009 1:22:58 PM
Reply:

Similar Artilces:

System.Net.WebException: The remote server returned an error: (500) Internal Server Error.
I have written a web service and tested it and it works fine from the .asmx test page. However, when I attempt to call it with a post I get this error:  The remote server returned an error: (500) Internal Server Error. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Net.WebException: The remote server returned an error: (500) Internal Server Error.Source Error: Line 164: myStream.Close() Line 165: Line 166: Dim SomeResponse As WebResponse = XmlHttp.GetResponse() Line 167: Dim strm As Stream = SomeResponse.GetResponseStream() Line 168: Dim sr As StreamReader = New StreamReader(strm) Source File: c:\inetpub\wwwroot\SCNet\App_Code\SCClientSvc.vb    Line: 166 Why does the test work fine but give a 500 error when I just try and get the response? Hi This is a general error message.  Pls take a look at the event log on server to view detailed error message. Make sure the Url you specified in code is correct.NOTE:If you find my response contains a reference to a third party World Wide Web site, I am providing this information as a convenience to you.Microsoft does not control these sites and has not tested any software or information found on these sites; therefore,Microsoft cannot make any representations regarding the ...

The remote server returned an error: (500) Internal Server Error.
When I remote access in website by application on window to extract data I have error : The remote server returned an error: (500) Internal Server Error. This is my code : Dim PostData As String = _ "__VIEWSTATE=" & tmpvs & _ "&txtUserName=" & UserID & _ "&txtPassword=" & PWord & _ "&chkPersistant=1" & _ "&btnSignIn=SignIn" '& _ Dim Data() As Byte = encoding.GetBytes(PostData) Dim LoginReq As Net.HttpWebRequest = Net.WebRequest.Create(loginURL) With LoginReq .KeepAlive = Fals...

remote server returned an error: (500) Internal Server Error.
Hi Frnds, I have Using HTTP Post Method ,Already create Webconfig fine(  <webServices>      <protocols>        <add name="HttpGet"/>        <add name="HttpPost"/>      </protocols>    </webServices> )But i got  remote server returned an error: (500) Internal Server Error. i am not using SOAP.. public void Post()        {      ...

The remote server returned an error: (500) Internal Server Error.
 System.Net.WebException: The remote server returned an error: (500) Internal Server Error.     i implemented the search functionality in the website searchdotnet some application i got ,i inegrated it ,it works fine localhost but on server i created some problemMark As Answer If my reply helped you. It means that an exception occured , you can specify in the web.config to show the exact exception to remote hosts.what is the <customErrors> configuration in your web.config ?   J.W.Please click "Mark as Answer" on this post if it helps you...

The remote server returned an error: (500) Internal Server Error
Hi  String strUrl = "http://catalogues.cataloguecentral.com.au/global/search/search.aspx?";              // Create a request using a URL that can receive a post.         WebRequest request = WebRequest.Create(strUrl);        // Set the Method property of the request to POST.        request.Method = "POST";        // Create POST data and convert it to a byte array.        string postData = "query_xml=<?xml version='1.0' encoding='utf-8' ?><search_xml><search before='25' after='25'><![CDATA[jacket]]> ...Blah Blah";      //  postData = postData.Replace((char)39, (char)34);       PostXml(strUrl, postData);     //   postData = postData.Replace("\\\", string.Empty);        //string postData = "?query_xml=" + getXMLString();        //postData = HttpUtility.UrlEncodeToBytes (postData);        byte[] byteArray = Encoding.UTF8.GetBytes(postData); //Encoding.UTF8.GetBytes(postData);        // Set the ContentType propert...

he remote server returned an error: (500) Internal Server Error.
Hi, I would like to connect a webservice. But I don't want to use "add web reference" -------------------------------------------------------------------------------------------- string strSoapMessage = "<?xml version='1.0' encoding='UTF-8'?>" + "<soap:Envelope xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema'>"+ "<soap:Body>"+ "<GenerateSessionKey xmlns='http://www.artwork-systems.com/webway/sessions'>"+ "<login>test</login>"+ "<auth>test<...

The remote server returned an error: (500) Internal Server Error
I have a VB.Net application where I am posting to an HTTP server that has a classic asp page and I am getting the following exception (it's throwing the exception on line 13).  Does anyone know how to troubleshoot this?  thanks  : <EXCEPTION> The remote server returned an error: (500) Internal Server Error </EXCEPTION> 1                            PostData = "externalID=" ID2 Dim strPath As String = "http://200.000.00.00/userfiles/someclassicasppage.asp" 3 request = CType(WebRequest.Create(strPath), HttpWebRequest) 4 request.ContentType = "application/x-www-form-urlencoded" 5 request.ContentLength = PostData.Length 6 request.Method = "POST" 7 request.AllowAutoRedirect = False 8 9 Dim requestStream As Stream = request.GetRequestStream() 10 Dim postBytes As Byte() = Encoding.ASCII.GetBytes(PostData) 11 requestStream.Write(postBytes, 0, postBytes.Length) 12 requestStream.Close() 13 response = CType(request.GetResponse(), System.Net.HttpWebResponse)    I have ...

The remote server returned an error: (500) Internal Server Error. #2
I am testing a utility program that loops through my localhost and pulls out all of the meta tag information and page titles.   After I do a recursive directory search and have all of the pages i convert the directory path's to urls and call the pages using the following code WebClient wc = new WebClient(uri); string page = wc.DownloadString(uri); This seems to work fine for the first few sites, however at a certain point i start getting (The remote server returned an error: (500) Internal Server Error.).  Nothing is wrong with the URI however it just seems to st...

The remote server returned an error: (500) Internal Server Error #2
Hello, I'm trying to send the request from site A to site B in localhost but get an error "The remote server returned an error: (500) Internal Server Error" in programatically.  The code below used to work for me and all of a certain it fails to send the request to site B (order site). The order site by itself is still up and running but when I try to send the request to this site in the code, it fails because of (500) Internal Server Error.  I also tried to restart the IIS but still doesn't work.  Does anyone knows why?  mReqUrl =...

The remote server returned an error: (500) Internal Server Error. #3
I am trying to access a web site using below snippet HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(url); HttpWebResponse webResponse = (HttpWebResponse)httpWebRequest.GetResponse(); This is occuring for particular web site and rest of the web site working fine.  Error:  The remote server returned an error: (500) Internal Server Error. at System.Net.HttpWebRequest.GetResponse() -532459699...  Also, i tried with below options 1. Adding Credential likeNetworkCredential networkCredential = new NetworkCredential("user name", "pwd", &qu...

Axis call to .Net web Service internal server error 500
 Hi, Desperately need advise as I'm not able to call a .Net web service. Problem is, the .Net web service works well when it's call via SoapUI. Could it be any .Net configuration being overlooked? Thanks in advance. After performing a network trace.. here are the details.. Call from Axis..POST /WebService/CPServices.asmx?wsdl HTTP/1.1Content-Type: multipart/related; boundary=MIMEBoundaryurn_uuid_84B12E522B4E0E31C41234969838674; type="application/xop+xml"; start="<0.urn:uuid:84B12E522B4E0E31C41234969838675@apache.org>"; start-info="ap...

Message="The remote server returned an error: (500) Internal Server Error."
 HI,when I try to call a simple web method with parameters using HTTP Post I am getting this error "Message="The remote server returned an error: (500) Internal Server Error.""  This My Web Method [WebMethod]        public string getDataWithParm1(string aaa)        {            string ss= "yytry";            ss =ss + " asdfg" ;            r...

How to solve:"The remote server returned an error: (500) Internal Server Error. "
 I am working On asp.net2.0(c#) In creating rss i used a user control by writing xml dynamically. It is working well in my personal server but in my client server it is producing error such that.. Server Error in '/GetReception' Application. The remote server returned an error: (500) Internal Server Error. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Net.WebException: The remote server returned an error: (500) Internal Server Error.Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace: [WebException: The remote server returned an error: (500) Internal Server Error.] System.Net.HttpWebRequest.GetResponse() +1529755 System.Xml.XmlDownloadManager.GetNonFileStream(Uri uri, ICredentials credentials) +61 System.Xml.XmlDownloadManager.GetStream(Uri uri, ICredentials credentials) +1865280 System.Xml.XmlUrlResolver.GetEntity(Uri absoluteUri, String role, Type ofObjectToReturn) +51 System.Xml.XmlTextReaderImpl.OpenUrlDelegate(Object xmlResolver) +44 System.Threading.CompressedStack.runTryCode(Object userData) +54 System.Runtime.CompilerServices.RuntimeHelpers.Execute...

Server Error: HTTP Error 500.19
I got the following error while trying to make a test WCF project on VistaServer Error HTTP Error 500.19 - Internal Server ErrorDescription: The requested page cannot be accessed because the related configuration data for the page is invalid. Error Code: 0x80070005 Notification: BeginRequest Module: IIS Web Core Requested URL: http://localhost:80/ProductsService/ProductsService.svc Physical Path: C:\Test\ProductsService\ProductsService\ProductsService.svc Logon User: Not yet determined Logon Method: Not yet determined Handler: Not yet determined Config Error: Cannot read configura...

Inconsistent 500 Internal Server Error with Web Service
I'm getting an inconsistent and occassional error with my webservice and it comes up with this error:  The remote server returned an error: (500) Internal Server Error. We doesn't happen all the time and seems to go away and come back on its own. Anybody ever seen this before???Its very strange. Hi codeaholic , That is a general error message. It means error happened inside Web Service. On server side open Event View you can get detailed error message that may be helpful to find the exact problem.NOTE:If you find my response contains a reference to a third party World Wide Web ...

500 internal Server error when invoke method on web service
Dears; i have the following problem i have web service i call it from web application; on the development environment its work fine when i create build and test the application on windows 2000 sp4; Xp service pack 2 and windows 2003 it works fine but when i install it on the customer machine its faild; the application cannot access method from the service and from the browser directly i get the error 500 Internal Server Error when i invoke any method from the service thier is somthing the deploy server include Active Directory and i cannot find the User ASPNET on the Local Users ...

500 internal server error when trying to access a web service
Hi,  I am trying to access a web service from an aspx page. It works fine when I do it on local host. But when I deploy the page to iis and try to access a web service, it is not working. When I debugged it using firebug, it is giving the following message.You have attempted to execute a CGI, ISAPI, or other executable program from a directory that does not allow programs to be executed.I am not sure what we should do to resolve this. can some one please guide us?Thanks,sridhar.     I haven't worked with Web Service deployment much, but it sounds like you just need ...

Dreaded (500) Internal Server Error when attempting to access web service on local machine.
I've got a pretty simple web service that works fine when I run it on it's own. But I have created a test web project with a page that sends the parameter in the query string to the web service. In my web form I have this code: string path = http://localhost/WebServices/ClarifyService/CaseCreate.asmx/CreateClarifyCase?Case=CHG000000060176 WebClient webClient = new WebClient(); byte[] response = null; try { response = webClient.DownloadData(path); //error occurs here } In my web service I have this method: [WebMethod] public string CreateCla...

HPPT Error 500.19
I am getting  HTTP Error 500.19 - Internal Server Error The requested page cannot be accessed because the related configuration data for the page is invalid. when I have redefined a secion in web.config like                 <!-- redefine an equivalent section -->                   6:             <section name="compilation" type="System.Web.Confi...

web service being closed by remote server errors
I'm having problems with a webservice being forced closed by the server. Inner exception information (level 1): Exception type: System.Net.WebException Exception message: The underlying connection was closed: A connection that was expected to be kept alive was closed by the server. Does anybody know a solution to a connection being forced closed?  It isn't consistent and happens suddenly.  Could there be a DNS or Proxy issue? If so, what is a work around?  Any help is appreciated... BW I've encountered this before, and it seemed to be limited to...

Unable to open the Web 'http://server/site'. Server Error: The version of Windows SharePoint Services running on the server is more recent than the version of FrontPage you are using. You need a more
I get this error trying to open a web created on W2003/IIS6/SPPS.  .NET2.0 is installed with it;s own IIS App Pool.  My web service web is assigned to that pool. "Unable to open the Web 'http://server/site'. Server Error: The version of Windows SharePoint Services running on the server is more recent than the version of FrontPage you are using. You need a more recent version of FrontPage. " The web was created with VS2005 installed on the server, but I'd rather not have VS installed on the server as a requirement.  /Bob C in GRR have you got a solution for this problem ?...

Internal Server Error Running Local Web Services App
I just wrote my first web service and a console app to call it. I have it locally, and in release mode. However, when I try to call it locally as a test: try{ HttpWebRequest webreq; HttpWebResponse webresp; string url = "http://localhost/NotificationService/Reminder.asmx/ProcessDailyReminders"; Console.WriteLine("Processing Daily Reminders..."); webreq = (HttpWebRequest)WebRequest.Create(url); webresp = (HttpWebResponse)webreq.GetResponse(); webresp.Close(); Console.WriteLine("Complete"); } catch (Exception ex){ //test// Console.WriteLine(ex.Message.ToString()); } ...

Web Service Server Error
PB 12.1 Classic I am having an error display (attached) when I go to test my web service. I have granted full access for ASPNET as well as the Anonymous account user to my Webform directory, the Sybase directory, and the Oracle directory. It looks like it is trying to connect so my thought is the Oracle ODP stuff but how do I track this down? Thanks, Chris Craft begin 666 Error.txt M4WES=&5M+E=E8BY397)V:6-E<RY0<F]T;V-O;',N4V]A<$5X8V5P=&EO;CH@ M5&AE('-P96-I9FEE9"!M;V1U;&4@8V]U;&0@;F]T(&)E(&9O=6YD+B H17AC M97!T:6]N(&...

FCKeditor XML request error: internal server error(500)
Hi all, i'm not sure that this is the right place to post this problem but i did :)i'm tring to use FCKeditor  in my .net application and every yhing is gooing well, but when i try to upload an image or create dir. to the server, the following error apear XML request error: internal server error(500), can any body help please. Hello Please See mySolution in below link http://forums.asp.net/thread/1516166.aspx This occur while you dont access to xml Pages file names and folder names transfer by xml file beetween fckeditor.dll and html pages www.yeknegah.com...

Web resources about - Web Service Error : The remote server returned an error: (500) Internal Server Error - asp.net.xml-web-services

Energy returned on energy invested - Wikipedia, the free encyclopedia
The natural or original sources of energy are not usually included in the calculation of energy invested, only the human-applied sources. For ...

How Facebook Returned A/B Testing To Mobile Apps
When Facebook rewrote its mobile applications and converted them from custom Web stacks to native development stacks, it lost the ability to ...

Facebook temporarily reveals ‘returned value’ metric for ads
Some Facebook advertisers temporarily saw a new metric called “returned value” in their Ads Manager dashboard. Facebook says the metric was accidentally ...

The Night Steve Jobs returned to Apple, Dec 20, 1996 - a set on Flickr
Working late on a Friday on December 20th at Apple Computer as Mac OS Evangelist, my manager came rushing past my office door saying to come ...

Batista reveals why he returned to WWE - YouTube
The Animal talks about overcoming a broken back, his immersion in Jiu-Jitsu training, and his desire to capture the WWE World Heavyweight Championship. ...

Fugitive US businessman Zack Shahin returned to UAE, says spokesman
... a taser following his release. A fugitive American businessman who is facing multi-million dirham corruption charges in Dubai has been returned ...

Bender is back! Belair’s favourite robot returned - AdelaideNow Search Search
GOOD news, everyone! Bender the robot — possibly the coolest letterbox in the Adelaide Hills — has been returned just days after being stolen. ...

War memento returned: 'It was like him coming home'
The home-made memento, fashioned into the shape of Australia and fastened around Richard Moffat's wrist with a length of leather, could have ...

Rochester's stolen Ned Kelly letterbox returned to rightful place on Northern Highway
Ned Kelly has finally seen the inside of a divvy van, but not as a result of his own crimes.

Young families have returned to the property market this year - DailyTelegraph Search Search
YOUNG families are back buying houses on the northern beaches after a year where they mostly stayed away.

Resources last updated: 3/10/2016 10:30:14 AM