无法运行第一个WCF服务
这是我的第一个WCF服务,我收到一个错误:无法运行第一个WCF服务,wcf,.net-4.0,Wcf,.net 4.0,这是我的第一个WCF服务,我收到一个错误: Failed to add a service. Service metadata may not be accessible. Make sure your service is running and exposing metadata. 代码: Web.Config <?xml version="1.0"?> <configuration> <system.web> <compil
Failed to add a service. Service metadata may not be accessible. Make sure your service is running and exposing metadata.
代码:
Web.Config
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.serviceModel>
<services>
<service name="WcfMathServiceLibrary.MathService">
<host>
<baseAddresses>
<add baseAddress="http://localhost:8732/WcfMathServiceLibrary/MathService/"/>
</baseAddresses>
</host>
<endpoint address="" binding="wsHttpBinding" contract="WcfMathServiceLibrary.MathService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" >
</endpoint>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="true"/>
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>
我不确定是什么问题。你能指导我吗?我认为你的合同可能需要指向接口,而不是具体的实现
<endpoint address="" binding="wsHttpBinding" contract="WcfMathServiceLibrary.IMath">
我不明白你的意思。我需要在地址中添加任何内容吗?不,只需更改合同以指向接口IMath而不是MathService
<endpoint address="" binding="wsHttpBinding" contract="WcfMathServiceLibrary.IMath">