简体   繁体   English

WCF REST服务在IIS6虚拟服务器上不起作用

[英]WCF REST service doesn't work on an IIS6 virtual server

Problem is I have a very simple WCF REST service, which I wrote starting from the WCF Service application template. 问题是我有一个非常简单的WCF REST服务,我是从WCF Service应用程序模板开始编写的。

I have one method, one class set up like this 我有一个方法,像这样设置一个类

[ServiceContract]
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall)]
public class MainService
{
    [WebGet(UriTemplate = "{ricCode}")]
    public IdentifierInfo GetByRicCode(string ricCode)
    {
         ...
    }
}

When ran from my machine I have no problems it works fine (typical). 从我的机器上运行时,我没有问题,它可以正常工作(典型)。 My problem is that when I publish this to a website on IIS6 (set up for anonymous access and on a virtual server) all I get from the above method is a 400 - invalid request. 我的问题是,当我将其发布到IIS6上的网站(设置为匿名访问并在虚拟服务器上)时,我从上述方法中获得的所有信息都是400个无效请求。

When I changed the method as a test to this 当我改变方法作为对此的测试

    [WebGet(UriTemplate = "")]
    public string GetByRicCode()
    {
         return "foo";
    }

and ran in on the IIS6 server it worked fine. 并在运行良好的IIS6服务器上运行。 Maybe I set up the virtual server wrong on IIS... any ideas please? 也许我在IIS上设置了错误的虚拟服务器...有什么想法吗?

我发现了问题,由于嵌套的web.configs,它引发了异常。

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

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