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" ;
            return ss;    
        }

 

and this is client call. In button click I am calling HTTPPost

 private void button1_Click(object sender, EventArgs e)
        {
             XmlDocument doc = new XmlDocument();
            doc.Load("aa.xml");

            HttpPost("http://localhost/HTTPSMessageCheck/MyService.asmx/getDataWithParm1", doc.OuterXml);
        }

 

 private string HttpPost(string URI, string Parameters)
        {
            try
            {
                System.Net.WebRequest req = System.Net.WebRequest.Create(URI);
                req.Proxy = new System.Net.WebProxy("UpdateCache", true);
              
                req.ContentType = "text/xml";
                req.Method = "POST";
                req.Timeout = 10000;

                byte[] bytes = System.Text.Encoding.ASCII.GetBytes(Parameters);
                req.ContentLength = bytes.Length;
               
                System.IO.Stream os = req.GetRequestStream();
                os.Write(bytes, 0, bytes.Length);
                os.Close();

                System.Net.WebResponse resp = req.GetResponse();
                if (resp == null) return null;

                System.IO.StreamReader sr = new System.IO.StreamReader(resp.GetResponseStream());
                return sr.ReadToEnd().Trim();
            }
            catch (Exception ee)
            {
                MessageBox.Show(ee.Message);
                return "";
            }
        }

 

 and XML file is 

<?xml version="1.0" encoding="utf-8"?>
<string xmlns="http://tempuri.org/">Mydata</string>

 

plz give me the solution for this.

thanks  in adv

0
lmvamsikrishna
2/22/2008 12:14:13 PM
asp.net.xml-web-services 7071 articles. 0 followers. Follow

2 Replies
560 Views

Similar Articles

[PageSpeed] 51

 hi,

 Please check for entry of HTTP POST in your web service  web.config file like this as below:

<webServices>
      <protocols>
       <add name="HttpSoap"/>
        <add name="HttpPost"/>
        <add name="HttpGet"/>
        <!--<add name="Documentation"/>-->
       
      </protocols>
    </webServices>

For accessing web service through HTTP Post this it should be in your web.config file.

Regards,

Jags 

 

0
jagsIN
2/22/2008 12:30:31 PM

 Hi Jags ,

thanks for replay,

I already changed that. if  I try to call a web method without parameters it is working fine. but I the web method is having  parameters then I am getting this error.

 

regards 

-krishna

0
lmvamsikrishna
2/25/2008 4:41:29 AM
Reply:

Similar Artilces:

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 return...

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) { ...

Only Firefox Get "Error code 500. Message: Internal Server Error"
I just started having a problem in Firefox 1.5.07, but not Opera or IE, when every I get to a site where where I'm directed to an htpps page, I get this diagnostic: Error code 500. Message: Internal Server Error. I've uninstalled and reinstalled Firefox and have cleared all personal data, cookies, files, directories, etc. I'm stuck! What can I do? Thanks a lot for your help. Trish Trish wrote: > I just started having a problem in Firefox 1.5.07, but not Opera or > IE, when every I get to a site where where I'm directed to an htpps > page, I g...

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() ...

FCK Editor "XML Request Error Internal server Error (500)"
Hi,     I don't know whether this is the right place to post my question.    I used FCK Editor 2.2 in my asp.net 2.0 application. While inserting the image by clicking the Browse Server button i am getting the "XML Request Error Internal Server Error(500)" only in online. It works fine locally. I have changed the web.config as <add key="FCKEditor" Userfilepath="http://www.mysite.com/fckeditor/editor/images/smiley"/> I still get this error. I don't know how to rectify this problem. Please give me an ...

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. &...

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 ...

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.
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()        {      ...

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. #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...

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 =...

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

Resources last updated: 12/23/2015 3:27:20 AM