简体   繁体   English

WCF数据服务访问问题-禁止使用403吗?

[英]WCF Data Services access issues - 403 forbidden?

I have Silverlight 4.0 client calling WCF data service, in the service I have write allow to all (I know that is not very wise, but I want to test it first): 我有调用WCF数据服务的Silverlight 4.0客户端,在该服务中,我已向所有人写入允许(我知道这不是很明智,但我想先对其进行测试):

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: 当我像这样使用BeginSaveChanges从客户端调用服务时:

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. 批处理操作响应代码为202,无论这意味着什么。

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. 问候。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM