我正在开发我的第一个 WCF 服务,但在尝试在 Visual Studio 中启动该服务时出现错误。因此,它将在 Cassini 下运行。
错误是:
Error: Cannot obtain Metadata from http://localhost:1393/BEService.svc
这是我的配置
<behaviors>
<serviceBehaviors>
<behavior name="metadataBehavior">
<serviceMetadata httpGetEnabled="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="metadataBehavior" name="DataServices.BEService">
<endpoint address="" binding="basicHttpBinding" contract="DataServices.IBEService" />
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:1393" />
</baseAddresses>
</host>
</service>
</services>
这是我定义服务合同的接口:
[ServiceContract]
public interface IBEService
{
[OperationContract]
string Get271EDI(string EDI, DDKSLib.Enums.EDIRequestor requestor);
}
这是实现它的类:
public class BEService : IBEService
{
public string Get271EDI(string EDI, Enums.EDIRequestor requestor)
{
return "this is a test";
}
}
我错过了什么?