我在做《WCF技术剖析》里面的第一个应用程序时,出现
这些错误,IIS我按照http://apps.hi.baidu.com/share/detail/1816653这里面的配置好了呀,
承载服务的代码是:
namespace Host
{
class ContractHost
{
static void Main(string[] args)
{
using (ServiceHost host = new ServiceHost(typeof(ContractsService)))
{
host.AddServiceEndpoint(typeof(ICalculator), new WSHttpBinding(), "http://localhost:8081/ContractsService");
if (host.Description.Behaviors.Find<ServiceMetadataBehavior>() == null)
{
ServiceMetadataBehavior behavior = new ServiceMetadataBehavior();
behavior.HttpGetEnabled = true;
behavior.HttpGetUrl = new Uri("http://localhost:8081/ContractsService/metadata");
host.Description.Behaviors.Add(behavior);
}
host.Opened += delegate
{
Console.WriteLine("ContractsService己启动,按任意键结束");
};
host.Open();
Console.Read();
}
}
}
}
错在哪里?
对了,http://localhost:8081/ContractsService中的ContractsService是自定义的吧。