我得到了:
仅当我在端点上使用相对地址时才会出现http 400错误请求
错误。
如果我从地址中删除“basic”,我可以毫无问题地查看WSDL定义:
http://localhost:8001/Test/
但是,只要我添加“基本”并打开浏览器并输入:
http://localhost:8001/Test/basic
我收到了错误。
这是我的配置:
<system.serviceModel>
<services>
<service name="HostConsole.ContactService"
behaviorConfiguration="ServiceBehavior" >
<host>
<baseAddresses>
<add baseAddress="http://localhost:8001/Test/"/>
</baseAddresses>
</host>
<endpoint address="basic"
binding="basicHttpBinding"
contract="HostConsole.IContactService">
</endpoint>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="ServiceBehavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
的ServiceHost:
ServiceHost host = new ServiceHost(typeof(ContactService));
try {
host.Open();
foreach (ServiceEndpoint se in host.Description.Endpoints) {
Console.WriteLine(string.Format(
"Address: {0}",
se.Address.Uri.AbsoluteUri));
}
Console.WriteLine("Enter to close");
Console.ReadLine();
host.Close();
}
catch (Exception ex) {
host.Abort();
Console.WriteLine(ex.Message);
Console.ReadLine();
}
答案 0 :(得分:0)
其中包含“basic”的地址字段位于完整的服务URL之后。我在这里看不到单独的服务激活或.svc文件的名称,但它会是这样的
http://localhost:8001/Test/YourService.svc/basic
。