我正在處理我的第一個WCF服務,並在嘗試在Visual Studio中啓動服務時收到錯誤消息。所以,它將在卡西尼下運行。WCF錯誤 - '無法獲取元數據'
的錯誤是:
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";
}
}
我錯過了什麼?
您是否有一個接口來定義您的合同以及實現它的類?如果是這樣,你可以請張貼代碼嗎? – Sam 2012-08-07 20:52:56
已添加到問題中。 – 2012-08-07 21:03:45
問題可能與在卡西尼上運行有關嗎? – 2012-08-08 14:00:32