【发布时间】:2011-01-26 06:59:31
【问题描述】:
我在 App.Config 文件中将两个端点定义为
<system.serviceModel>
<services>
<service
name="HostDirectAddress.ITestService"
behaviorConfiguration="behaviorConfig">
<endpoint
address="net.tcp://localhost:9000/ITestService"
binding="netTcpBinding"
contract="HostDirectAddress.ITestServiceContract"/>
<endpoint
address="http://localhost:9000/mex"
binding="mexHttpBinding"
contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="behaviorConfig">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="True"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
我的客户来电
static void Main(string[] args)
{
ServiceHost host =
new ServiceHost(typeof(HostDirectAddress.ITestService));
host.Open();
Console.WriteLine("....Service is Ready to Consume...");
Console.ReadLine();
}
我在尝试启动主机时收到以下错误
ServiceMetadataBehavior 的 HttpGetEnabled 属性设置为 true,HttpGetUrl 属性是相对地址,但没有 http 基地址。要么提供一个 http 基地址,要么将 HttpGetUrl 设置为一个绝对地址。
如何解决?
【问题讨论】: