I am getting a Bad Request (Invalid host)
when trying to run my C# WCF service under mono. This service is part of an application, not being hosted using a web server.
I have configured my services with the following:
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="DefaultServiceBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="DefaultServiceBehavior" name="MyServices.TaskServic开发者_StackOverflowe">
<endpoint address="V1" binding="basicHttpBinding" contract="MyServices.ITaskServiceV1" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:8731/MyServices/Tasks" />
</baseAddresses>
</host>
</service>
</services>
</system.serviceModel>
When I try to visit http://localhost:8731/MyServices/Tasks
or any of its endpoints (including ?wsdl
), I get the 400 error.
I have deployed this successfully using the .net runtime, just can't figure out what's wrong for deploying with mono. Any help would be greatly appreciated.
EDIT Mono version: 2.10.1
I had the same issue today. Hosting a wcf service inside a .net 3.5 application worked but same code using mono 3.2.2 gives invalid host error response. So I checked mono source and found out that mono searches for a valid endpoint from request url using case sensitive compare. Changed my url to fit case like in my service config resolved the issue.
精彩评论