WCF中的服务器错误

WCF中的服务器错误,wcf,Wcf,我得到这个错误: “/cms”应用程序中的服务器错误。 此集合已包含具有方案http的地址。那里 此集合中每个方案最多只能有一个地址。如果你的 服务正在IIS中托管。您可以通过设置 'system.serviceModel/serviceHostingEnvironment/multipleSiteBindingsEnabled' 使真实或具体化 “system.serviceModel/serviceHostingEnvironment/baseAddressPrefixFilters”。 参

我得到这个错误:

“/cms”应用程序中的服务器错误。 此集合已包含具有方案http的地址。那里 此集合中每个方案最多只能有一个地址。如果你的 服务正在IIS中托管。您可以通过设置 'system.serviceModel/serviceHostingEnvironment/multipleSiteBindingsEnabled' 使真实或具体化 “system.serviceModel/serviceHostingEnvironment/baseAddressPrefixFilters”。 参数名称:项说明:发生未处理的异常 在执行当前web请求期间。请检查 堆栈跟踪以获取有关错误及其位置的详细信息 源于代码

例外情况详情:

System.ArgumentException: This collection already contains an address with scheme http.  There can be at most one address per scheme
在这个集合中。如果您的服务托管在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
收藏。如果您的服务托管在IIS中,则可以修复 设置问题 'system.serviceModel/serviceHostingEnvironment/multipleSiteBindingsEnabled' 使真实或具体化 “system.serviceModel/serviceHostingEnvironment/baseAddressPrefixFilters”。 参数名称:项目] System.ServiceModel.UrischemeKeydCollection.InsertItem(Int32索引,Uri项)+16395359 System.Collections.Generic.SynchronizedCollection`1.Add(T项)+79 System.ServiceModel.UrischemeKeydCollection..ctor(Uri[]地址)+222 System.ServiceModel.ServiceHost..ctor(类型serviceType,Uri[]基本地址)+346 System.ServiceModel.Activation.ServiceHostFactory.CreateServiceHost(类型 服务类型,Uri[]基本地址)+43 System.ServiceModel.Activation.ServiceHostFactory.CreateServiceHost(字符串 构造函数字符串,Uri[]基地址)+530 System.ServiceModel.HostingManager.CreateService(字符串规范化VirtualPath)+1413 System.ServiceModel.HostingManager.ActivateService(字符串规范化VirtualPath)+50 System.ServiceModel.HostingManager.EnsureServiceAvailable(字符串 标准化虚拟路径)+1172

消息是:此集合已包含具有scheme的地址 http。此集合中每个方案最多只能有一个地址。 如果您的服务托管在IIS中,您可以通过 背景 'system.serviceModel/serviceHostingEnvironment/multipleSiteBindingsEnabled' 使真实或具体化 “system.serviceModel/serviceHostingEnvironment/baseAddressPrefixFilters”。 参数名称:项。] System.Runtime.AsyncResult.End(IAsyncResult结果)+901424 System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult 结果)+178702 System.Web.AsyncEventExecutionStep.OnAsyncEventCompletion(IAsyncResult ar)+107

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


我做错了什么?

您的web.config文件中是否有具有多个端点的服务?如果单个服务有多个端点(在第节中),则只有一个端点可以没有地址属性集。其他端点需要具有地址设置

在客户端,如果要使用具有新端点地址的端点,则需要将其包含在地址中,例如“http://localhost/cms/Service.svc/newEP"


正如Steven Cheng所说:

根据我的理解,当WCF的IIS 托管站点有多个与之关联的主机头(而WCF主机 每个传输方案只能接受一个基址)

他建议对这个问题和决议进行解释:


…我想链接到源,但我已经丢失了它…

你在试图做什么导致了问题?如果你可以编辑此问题以使其清晰,请将其标记以供版主注意。此问题非常简单,我感觉我在这里被每个人埋伏了。你为什么要结束一个简单的问题?我经常看到这样的问题,它们非常有帮助。我的建议是,如果你觉得这是不完整的,那么你可能不理解这个主题。还有其他几个人确实理解这一点,他们能够在你们投票结束这个问题之前提供一个答案来帮助我。请不要再投票来结束我的问题。如果一堆文本得到了一个好的、被接受的答案,那很可能是一个侥幸。+1是一个谷歌搜索答案的好方法
[ServiceActivationException: The service '/cms/service.svc' cannot be activated due to an exception during compilation.  The exception