2010-06-11 42 views
1

我的Silverlight 4.0的客戶端調用WCF數據服務,在服務中我寫的讓所有(我知道這是不是很明智,但我想首先測試它):WCF數據服務訪問問題 - 403禁止?

public static void InitializeService(DataServiceConfiguration config) 
{ 
    // TODO: set rules to indicate which entity sets and service operations are visible, updatable, etc. 
    // Examples: 
    config.SetEntitySetAccessRule("*", EntitySetRights.All); 
    config.SetServiceOperationAccessRule("*", ServiceOperationRights.All); 
    config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V2; 
    config.UseVerboseErrors = true; 

} 

當我打電話了從客戶服務使用BeginSaveChanges這樣的:

MyServiceEntity.BeginSaveChanges(SaveChangesOptions.Batch, OnChangesSaved, MyServiceEntity); 

我收到禁錯誤:

--batchresponse_a7bc1f95-8f8d-4e3b-9e24-108743499c3a 
Content-Type: multipart/mixed; boundary=changesetresponse_04a92dd2-1fe4-4da5-8d2e-e020fe354f8f 

--changesetresponse_04a92dd2-1fe4-4da5-8d2e-e020fe354f8f 
Content-Type: application/http 
Content-Transfer-Encoding: binary 

HTTP/1.1 403 Forbidden 
Content-ID: 1 
DataServiceVersion: 1.0; 
Content-Type: application/xml 

<?xml version="1.0" encoding="utf-8" standalone="yes"?> 
<error xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"> 
<code></code> 
<message xml:lang="en-US">Forbidden</message> 
</error> 
--changesetresponse_04a92dd2-1fe4-4da5-8d2e-e020fe354f8f-- 
--batchresponse_a7bc1f95-8f8d-4e3b-9e24-108743499c3a-- 

和批量操作響應代碼202,無論這應該是什麼意思。

任何幫助表示讚賞。

回答

1

我知道它看起來很明顯,但是,在您更改允許寫入的權限後,您是否將服務發佈到了生產環境? 只是確保你指向正確的服務網址。 關於。