简体   繁体   中英

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.

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.

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. Maybe I set up the virtual server wrong on IIS... any ideas please?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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