WCF中的服务器错误

Bil*_*rty -1 wcf

我收到此错误:

'/ cms'应用程序中的服务器错误.

此集合已包含方案http的地址.此集合中每个方案最多只能有一个地址.如果您的服务在IIS所驻留你可以通过设置"system.serviceModel/serviceHostingEnvironment/multipleSiteBindingsEnabled"为真或指定"system.serviceModel/serviceHostingEnvironment/baseAddressPrefixFilters"解决问题.参数名称:item描述:执行当前Web请求期间发生未处理的异常.请查看堆栈跟踪以获取有关错误及其源自代码的位置的更多信息.

例外细节:

System.ArgumentException: This collection already contains an address with scheme http.  There can be at most one address per scheme
Run Code Online (Sandbox Code Playgroud)

在这个集合中.如果您的服务在IIS所驻留你可以通过设置"system.serviceModel/serviceHostingEnvironment/multipleSiteBindingsEnabled"为真或指定"system.serviceModel/serviceHostingEnvironment/baseAddressPrefixFilters"解决问题.参数名称:item

来源错误:

在执行当前Web请求期间生成了未处理的异常.可以使用下面的异常堆栈跟踪来识别有关异常的起源和位置的信息.

堆栈跟踪:

[ArgumentException: This collection already contains an address with scheme http.  There can be at most one address per scheme in this
Run Code Online (Sandbox Code Playgroud)

采集.如果您的服务在IIS所驻留你可以通过设置"system.serviceModel/serviceHostingEnvironment/multipleSiteBindingsEnabled"为真或指定"system.serviceModel/serviceHostingEnvironment/baseAddressPrefixFilters"解决问题.参数名称:item] System.ServiceModel.UriSchemeKeyedCollection.InsertItem(Int32 index,Uri item)+16395359 System.Collections.Generic.SynchronizedCollection`1.Add(T item)+79 System.ServiceModel.UriSchemeKeyedCollection..ctor(Uri []地址)+222 System.ServiceModel.ServiceHost..ctor(类型serviceType,Uri [] baseAddresses)+346 System.ServiceModel.Activation.ServiceHostFactory.CreateServiceHost(类型serviceType,Uri [] baseAddresses)+43 System.ServiceModel.Activation.ServiceHostFactory .CreateServiceHost(String constructorString,Uri [] baseAddresses)+530 System.ServiceModel.HostingManager.CreateService(String normalizedVirtualPath)+1413 System.ServiceModel.HostingManager.ActivateService(String normalizedVirtualPath)+50 System.ServiceModel.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath) 1172

[ServiceActivationException: The service '/cms/service.svc' cannot be activated due to an exception during compilation.  The exception
Run Code Online (Sandbox Code Playgroud)

消息是:此集合已包含方案http的地址.此集合中每个方案最多只能有一个地址.如果您的服务在IIS所驻留你可以通过设置"system.serviceModel/serviceHostingEnvironment/multipleSiteBindingsEnabled"为真或指定"system.serviceModel/serviceHostingEnvironment/baseAddressPrefixFilters"解决问题.参数名称:item.] System.Runtime.AsyncResult.End(IAsyncResult result)+901424 System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result)+178702 System.Web.AsyncEventExecutionStep.OnAsyncEventCompletion(IAsyncResult ar)+107

-------------------------------------------------- ------------------------------版本信息:Microsoft .NET Framework版本:4.0.30319; ASP.NET版本:4.0.30319.237

我究竟做错了什么?

Nei*_*son 5

正如Steven Cheng曾经说过:

根据我的理解,当WCF的IIS主机站点有多个与之关联的主机头时,预计会出现此错误(而WCF主机只能为每个传输方案接受一个基址).

他提出了一个很好的博客文章来解释这个问题和解决方案:

..我会链接到源,但我已经失去了它...