简体   繁体   English

格式错误的请求(WCF数据服务)

[英]Malformed Request (WCF Data Service)

I used WCF Data Service for CRUD operations. 我将WCF数据服务用于CRUD操作。 I have one remote service and many clients (computers). 我有一个远程服务和许多客户端(计算机)。 Some client reseived error on all edit operation (context have entity and we edit it now). 一些客户端在所有编辑操作上都返回了错误(上下文具有实体,我们现在对其进行编辑)。 Returned exception contains next message:"Your Browser sent a request with an unknown method (MERGE)". 返回的异常包含下一条消息:“您的浏览器发送了带有未知方法(MERGE)的请求”。 All clients uses Windows 7 with Framework 4.5. 所有客户端都使用Windows 7和Framework 4.5。 What can be the reason for this? 这可能是什么原因?

Service has a initialize method: 服务具有初始化方法:

        // This method is called only once to initialize service-wide policies.
    public static void InitializeService(DataServiceConfiguration config)
    {
        // TODO: set rules to indicate which entity sets and service operations are visible, updatable, etc.
        // Examples:
        config.UseVerboseErrors = true;
        config.SetEntitySetAccessRule("doc", EntitySetRights.All);
        config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V3;
    }

UPD1: It was found that the error disappears when client application running under an Administrator account (ie Administrator can edit entity without error). UPD1:发现在以Administrator帐户运行的客户端应用程序时错误消失了(即Administrator可以编辑实体而没有错误)。 Perhaps the problem in the ClickOnce deployment. 可能是ClickOnce部署中的问题。

UPD2: The reason in using the proxy server. UPD2:使用代理服务器的原因。 Researching continues... 研究仍在继续...

Solved a problem with a WCF Data Service and HTTP-requests (like HTTP MERGE) locking by proxy-server ( http://msdn.microsoft.com/en-us/library/dd541471.aspx ). 解决了WCF数据服务和代理服务器( http://msdn.microsoft.com/zh-cn/library/dd541471.aspx )锁定HTTP请求(例如HTTP MERGE)的问题。 The decision came down to one C# line for client service proxy-class using tunneling: 对于使用隧道的客户端服务代理类,该决定归结为一条C#行:

 docService.UsePostTunneling = true;

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

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