WCF / ASMX :: REST IIS 7 Bad Request 400
Sep 23, 2010
tried so many different things but havent got past this seemingly trivial problem. I created a WCF service application from visual studio 2010 WCF templates. it generated the IService.cs and Service1.svc files and generated the web.config
i created a website in IIS 7 on windows 2008, and pointed it to the app folder. when i go to [URL] via web browser, i get a message indicating service is running and suggests using svcutil etc etc., but when i go to [URL] the web browser says 400 bad request. this is without changing anything from what VS generated. the operation contract looks like
[Code]....
Update: forgot to mention i even tried decorating the operation with WebGet attribute with UriTemplate parameter, without luck.
View 4 Replies
Dec 23, 2010
I created a WCF. The web.config is as follows,
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.web>
<compilation debug="true" />
</system.web>
<system.serviceModel>
</system.serviceModel>
<system.webServer>
<directoryBrowse enabled="true" />
</system.webServer>
</configuration>
The following can be seen in the service.svc file,
class AppServiceHostFactory : ServiceHostFactory
{
protected override ServiceHost CreateServiceHost(Type serviceType, Uri[] baseAddresses)
{
return new WebServiceHost2(serviceType, true, baseAddresses);
}
}
This is the method in the service.svc.cs,
[WebHelp(Comment="Sample description for GetData")]
[WebGet(UriTemplate="/GetData/param1/{i}/param2/{s}")]
[OperationContract]
public SampleResponseBody GetData(string i, string s)
{
// TODO: Change the sample implementation here
// if (i < 0) throw new WebProtocolException(HttpStatusCode.BadRequest, "param1 cannot be negative", null);
return new SampleResponseBody()
{
Value = String.Format("Sample GetData response: '{0}', '{1}'", i, s)
};
}
The following is the webservice url. It returns data if it's run through the asp.net engine but throws bad request when run from IIS. I added the following entry in the web.config but no use. it still fails.
<httpRuntime maxRequestLength="1500000" executionTimeout="180"/>
[URL]-499,500~~~/param2/621100,621600,622100,611500,611600,611700,561300,611100,611200,611300,611400,622200,622300,623100,621100,621600,622100,611500,611600,611700,561300,611100,611200,611300,611400,622200,622300,623100,621100,621600,622100,611500,611600,611700,561300,611100,611200,611300,611400,622200,622300,623100,,622100,611500,611600,611700,561300,611100,611200,611300,611400,622200,622300,623100,611100,611200,611300,611400,622200,622300,623100,611100,611200,611300,611400,622200,622300,623100,611100,611200,611300,611400,622200,622300,623100,623100,611100,611200,611300,611400,622200,622300,623100,623100,611100,611200,611300,611400,622200,622300,623100,622300,623100,623100,611100,611200,611300,611400,622200,622300,623100,622300,623100,623100,611100,611200,611300,611400,622200,622300,623100,623100,623100,611100,611200,611300,611400,622200,622300,623100,623100,623100,611100,611200,611300,611400,622200,622300,623100,623100,623100,611100,611200,611300,611400,622200,622300,623100
View 2 Replies