WCF service response "HTTP / 1.1 400 Bad Request" on shared hosting <aka Blank page, XML parsing error, Invalid address, web page not found>
This is both information for those who are experiencing a problem, and a question.
edit: The question is why the reset of "www." from a URL cause this error when a website running at the same address can link without "www." .
I recently reproduced this problem using the trivial WCF service (one of endpoint.tv) after resolving the usual configuration problems that the service encounters when moving the service from local IIS to shared hosting.
The problem was the following answer (from the violinist) when checking the URL in the browser. When searching the Internet for messages on this topic, I found a series of unresolved issues pointing to the same problem in addition to messages that fix common problems with shared hosting.
Invalid HTTP / 1.1 400 request Server: Microsoft-IIS / 7.0 X-Powered-By: ASP.NET Date: Tue, Aug 17, 2010 00:27:52 GMT Content-Length: 0
In Safari / Chrome, this appears as a blank page.
In IE, you get "The webpage cannot be found."
In FF you get "XML Parsing Error: no element found" Location: http: // ................ Line number 1, column 1: "(which I saw in numerous unresolved messages on the Internet - do not hesitate to pay a possible solution)
Opera " "
, "www". URL- .
.
WCF.
, :
WCF, , -, ? "www." , .
GoDaddy. .
, - , , , WCF , . , , ( ).
web.config, , , .
<?xml version="1.0"?>
<configuration>
<system.web>
<customErrors mode="Off"/>
<compilation><!--debug="true"-->
<buildProviders>
<remove extension=".svc"/>
<add extension=".svc" type="System.ServiceModel.Activation.ServiceBuildProvider,System.ServiceModel, Version=3.0.0.0, Culture=neutral,PublicKeyToken=b77a5c561934e089"/>
</buildProviders>
</compilation>
</system.web>
<!-- When deploying the service library project, the content of the config file must be added to the host
app.config file. System.Configuration does not support config files for libraries. -->
<system.serviceModel>
<services>
<service behaviorConfiguration="blah"
name="WCFServ.EvalService">
<endpoint address="http://www.abcdomain.com/WCFServ/WCFServ.EvalService.svc"
binding="basicHttpBinding"
contract="WCFServ.IEvalService" />
<endpoint address="http://abcdomain.com/WCFServ/WCFServ.EvalService.svc"
binding="basicHttpBinding"
contract="WCFServ.IEvalService" />
<!--<endpoint address=""
binding="mexHttpBinding"
contract="IMetadataExchange" />-->
<!--<host>
<baseAddresses>
<add baseAddress="http://abcdomain.com/WCFServ/" />
</baseAddresses>
</host>-->
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="blah">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment>
<baseAddressPrefixFilters>
<add prefix="http://www.abcdomain.com/WCFServ/"/>
</baseAddressPrefixFilters>
</serviceHostingEnvironment>
</system.serviceModel>
<!--http://localhost/WCFServ/WCFServ.EvalService.svc-->
<startup><supportedRuntime version="v2.0.50727"/></startup></configuration>
URL- , WCF HTTP-, .
- ; , . , -, www.example.com, example.com. , -, example.com 404, DNS , www.example.com.
, , , - (), . :
<services>
<service behaviorConfiguration="blah" name="WCFServ.EvalService">
<endpoint address="/WCFServ/WCFServ.EvalService.svc"
binding="basicHttpBinding"
contract="WCFServ.IEvalService"/>
</service>
</services>
<!-- Just leave this out
<serviceHostingEnvironment>
<baseAddressPrefixFilters>
<add prefix="http://www.abcdomain.com/WCFServ/"/>
</baseAddressPrefixFilters>
</serviceHostingEnvironment>
-->