开发者

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

开发者 https://www.devze.com 2023-04-01 16:57 出处:网络
Problem is I have a very simple WCF REST service, which I wrote starting from the WCF Service application template.

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 anonym开发者_C百科ous 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?


I figured out the problem, it was throwing an exception due to nested web.configs How annoying.

0

精彩评论

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