2012-02-17 108 views
3

我正在嘗試調用Web服務幾個小時。 我已經加入clientaccesspolicy.xml:遠程服務器返回錯誤:NotFound。 Silverlight + WCF

<?xml version="1.0" encoding="utf-8"?> 
<access-policy> 
    <cross-domain-access> 
    <policy> 
     <allow-from http-request-headers="*"> 
     <domain uri="*"/> 
     </allow-from> 
     <grant-to> 
     <resource path="/" include-subpaths="true"/> 
     </grant-to> 
    </policy> 
    </cross-domain-access> 
</access-policy> 

和crossdomain.xml的:

<?xml version="1.0"?> 
<!DOCTYPE cross-domain-policy SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd"> 
<cross-domain-policy> 
    <allow-http-request-headers-from domain="*" headers="SOAPAction,Content-Type"/> 
</cross-domain-policy> 

根我的網站的目錄。 從IIS調用Web服務,它在這裏工作。

但是,當我試圖調用從Silverlight應用程序我的WCF Web服務我得到這個錯誤:

遠程服務器返回錯誤:NOTFOUND。

這是日誌從小提琴手:

a:InternalServiceFaultThe server was unable to process the request due to an internal error. For more information about the error, either turn on IncludeExceptionDetailInFaults (either from ServiceBehaviorAttribute or from the <serviceDebug> configuration behavior) on the server in order to send the exception information back to the client, or turn on tracing as per the Microsoft .NET Framework 3.0 SDK documentation and inspect the server trace logs.

這是代碼,當我得到一個錯誤:

public int EndUserExist(System.IAsyncResult result) { 
     object[] _args = new object[0]; 
     int _result = ((int)(base.EndInvoke("UserExist", _args, result))); //Here 
     return _result; 
      } 

我在做什麼錯?

+0

驗證您的端點配置是否正確。如果您使用基於wsdl的Visual Studio構建的代理類,您還可以檢查它是否正確定義(尤其是,如果它包含UserExist方法並使用適當的參數) – 2012-02-17 21:44:06

回答

0

好吧;) 現在工作。 我打開了web.config中的調試,所以我得到了Fiddler中的異常消息。 我需要在IIS上爲sql數據庫設置標識用戶。

9

查看您的web.config文本:IncludeExceptionDetailInFaults 將其設置爲true。然後再次運行你的服務請求,看看Fiddler這次會告訴你你需要知道什麼。 可能是從SQL錯誤到空引用的任何內容。 :-)

+0

更重要的是,我使用sql連接創建了一個簡單的項目,字符串到這個sqlConn,它沒有任何麻煩開放... – ogrod87 2012-02-17 22:14:31

0

在您的移動設備中,轉到WiFi設置並編輯當前的無線連接。 設置代理「自動檢測設置」。

相關問題