我已经创建了简单的 Web 服务。代码:
[ServiceContract]
public interface ITsdxService
{
[OperationContract]
void DoWork();
[OperationContract]
string Test();
}
public class TsdxService : ITsdxService
{
public void DoWork()
{
}
public string Test()
{
return "Hello World!";
}
}
网络配置:
<system.serviceModel>
<services>
<service name="Test.TSDX.UI.TsdxService">
<endpoint
address="Tsdx"
binding="wsHttpBinding"
bindingConfiguration="TestBinding"
contract="Test.TSDX.UI.ITsdxService" />
</service>
</services>
<bindings>
<wsHttpBinding>
<binding name="TestBinding" />
</wsHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
当我从 Visual Studio 运行时,我输入 localhost:50517/TsdxService.svc?wsdl 一切正常 - 我可以看到 wsdl,但是当我输入 localhost:50517/TsdxService.svc/Tsdx/Test 或 localhost:50517/TsdxService.svc/ Tsdx/DoWork 我什么也没看到。Fiddler 告诉我我收到 400 错误。断点(在 Test 和 DoWork 方法上)不起作用。为什么?我做错了什么?