开发者

WCF Data Services access issues - 403 forbidden?

开发者 https://www.devze.com 2023-01-02 23:15 出处:网络
I have Silverlight 4.0 client calling WCF data service, in the ser开发者_如何学Cvice I have write allow to all (I know that is not very wise, but I want to test it first):

I have Silverlight 4.0 client calling WCF data service, in the ser开发者_如何学Cvice I have write allow to all (I know that is not very wise, but I want to test it first):

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;

}

when I call the service from the client using BeginSaveChanges like this:

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

I receive forbidden error:

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

And Batch operation response code is 202, whatever this is supposed to mean.

Any help is appreciated.


I know its seems very obvious but, did you publish your service to production after you changed the right to allow write? just make sure you are pointing to the correct service url. regards.

0

精彩评论

暂无评论...
验证码 换一张
取 消