2012-05-17 187 views
0

當我運行下面的代碼時,出現ex = {「遠程服務器返回錯誤:(500)內部服務器錯誤。」}任何人都可以幫助我解決這個問題...調用restful webservice時出現(500)內部服務器錯誤

HttpWebRequest request = WebRequest.Create("http://project.i-engage.org/tasks/webservices/bugnetservices.asmx/GetCategories?ProjectID=17") as HttpWebRequest; 
    request.Credentials = new NetworkCredential("rolland", "409cleaner"); 
    request.ContentType = "application/json; charset = utf - 8"; 
    request.Method = "POST"; 

    using (Stream stm = request.GetRequestStream()) 
    { 
     using (StreamWriter stmw = new StreamWriter(stm)) 
     { 
      stmw.Write(soap); 
     } 
    } 

    // Get response 
    using (HttpWebResponse response = request.GetResponse() as HttpWebResponse) 
    { 
     // Get the response stream 
     StreamReader reader = new StreamReader(response.GetResponseStream()); 
     // Console application output 
     Console.WriteLine(reader.ReadToEnd()); 
    } 
+1

無法看到服務器代碼或服務器上的詳細消息。你能檢查服務器上的事件查看器嗎? – jrummell

+0

@ jrummell ...我沒有在服務器上找到任何東西 – Tronics

+0

什麼是肥皂在這裏? –

回答

0

它的問題與web服務......他們沒有返回auth cookie ..現在它的工作正常。

+0

很高興你找到了解決辦法!你能否給你的答案增加一些細節? – Flexo

相關問題