我在.Net 4.0上有一个WCF Rest服务,当使用我的本地IIS 7.5时,这项服务运行良好。但我有一个虚拟主机软件包,当我向他们发布服务时收到一个应用程序错误,详细说明错误类型。以前我在.Net 4.0上发布了其他种类的WCF服务,这没关系。部署该服务的公司是Arvixe,我已联系他们的支持,他们告诉我将处理程序添加到我的web.config。但这不再有效。
这是我的web.config文件
<validation validateIntegratedModeConfiguration="false"/>
<modules runAllManagedModulesForAllRequests="true">
<add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</modules>
<handlers>
<!-- Make sure we can use this handler for any URL because we're using ReST. The default is
for it to be used only for .svc -->
<remove name="svc-Integrated-4.0" />
<add name="svc-Integrated-4.0" path="*" verb="*" type="System.ServiceModel.Activation.ServiceHttpHandlerFactory, System.ServiceModel.Activation, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" resourceType="Unspecified" requireAccess="Script" preCondition="integratedMode,runtimeVersionv4.0" />
<add name="UrlRoutingHandler" preCondition="integratedMode" verb="*" path="UrlRouting.axd" type="System.Web.HttpForbiddenHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</handlers>
当我在我的wcf服务上调用操作时,这是我的跟踪日志!
System.ServiceModel错误:131075:http://msdn.microsoft.com/en-US/library/System.ServiceModel.Diagnostics.ThrowingException.aspxThrowing exception./LM/W3SVC/703/ROOT-3-129547865876462000System .ArgumentException,mscorlib,Version = 4.0.0.0,Culture = neutral,PublicKeyToken = b77a5c561934e089此集合已包含带有方案http的地址。此集合中每个方案最多只能有一个地址。如果您的服务是在IIS中托管的,则可以通过将'system.serviceModel / serviceHostingEnvironment / multipleSiteBindingsEnabled'设置为true或指定'system.serviceModel / serviceHostingEnvironment / baseAddressPrefixFilters'来解决问题。
参数名称:System.ServiceModel.UriSchemeKeyedCollection.InsertItem(Int32 index,Uri item)中的项目
在System.Collections.Generic.SynchronizedCollection 1.Add(T item)
at System.ServiceModel.UriSchemeKeyedCollection..ctor(Uri[] addresses)
at System.ServiceModel.ServiceHost..ctor(Type serviceType, Uri[] baseAddresses)
at System.ServiceModel.Activation.WebServiceHostFactory.CreateServiceHost(Type serviceType, Uri[] baseAddresses)
at System.ServiceModel.Activation.ServiceHostFactory.CreateServiceHost(String constructorString, Uri[] baseAddresses)
at System.ServiceModel.ServiceHostingEnvironment.HostingManager.CreateService(String normalizedVirtualPath)
at System.ServiceModel.ServiceHostingEnvironment.HostingManager.ActivateService(String normalizedVirtualPath)
at System.ServiceModel.ServiceHostingEnvironment.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath)
at System.ServiceModel.ServiceHostingEnvironment.EnsureServiceAvailableFast(String relativeVirtualPath)
at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.HandleRequest()
at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.BeginRequest()
at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.OnBeginRequest(Object state)
at System.ServiceModel.AspNetPartialTrustHelpers.PartialTrustInvoke(ContextCallback callback, Object state)
at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.OnBeginRequestWithFlow(Object state)
at System.Runtime.IOThreadScheduler.ScheduledOverlapped.IOCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped)
at System.Runtime.Fx.IOCompletionThunk.UnhandledExceptionFrame(UInt32 error, UInt32 bytesRead, NativeOverlapped* nativeOverlapped)
at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)
</StackTrace><ExceptionString>System.ArgumentException: This collection already contains an address with scheme http. There can be at most one address per scheme in this collection. If your service is being hosted in IIS you can fix the problem by setting 'system.serviceModel/serviceHostingEnvironment/multipleSiteBindingsEnabled' to true or specifying 'system.serviceModel/serviceHostingEnvironment/baseAddressPrefixFilters'.
Parameter name: item</ExceptionString></Exception></TraceRecord>
System.ServiceModel Error: 131074 : <TraceRecord xmlns="http://schemas.microsoft.com/2004/10/E2ETraceEvent/TraceRecord" Severity="Error"><TraceIdentifier>http://msdn.microsoft.com/en-US/library/System.ServiceModel.Diagnostics.EventLog.aspx</TraceIdentifier><Description>Wrote to the EventLog.</Description><AppDomain>/LM/W3SVC/703/ROOT-3-129547865876462000</AppDomain><ExtendedData xmlns="http://schemas.microsoft.com/2006/08/ServiceModel/DictionaryTraceRecord"><CategoryID.Name>WebHost</CategoryID.Name><CategoryID.Value>5</CategoryID.Value><InstanceID.Name>WebHostFailedToProcessRequest</InstanceID.Name><InstanceID.Value>3221356547</InstanceID.Value><Value0>System.ServiceModel.ServiceHostingEnvironment+HostingManager/50346327</Value0><Value1>System.ServiceModel.ServiceActivationException: The service '/ForgetTrafficService.svc' cannot be activated due to an exception during compilation. The exception message is: This collection already contains an address with scheme http. There can be at most one address per scheme in this collection. If your service is being hosted in IIS you can fix the problem by setting 'system.serviceModel/serviceHostingEnvironment/multipleSiteBindingsEnabled' to true or specifying 'system.serviceModel/serviceHostingEnvironment/baseAddressPrefixFilters'.
Parameter name: item. ---&gt; System.ArgumentException: This collection already contains an address with scheme http. There can be at most one address per scheme in this collection. If your service is being hosted in IIS you can fix the problem by setting 'system.serviceModel/serviceHostingEnvironment/multipleSiteBindingsEnabled' to true or specifying 'system.serviceModel/serviceHostingEnvironment/baseAddressPrefixFilters'.
Parameter name: item
at System.ServiceModel.UriSchemeKeyedCollection.InsertItem(Int32 index, Uri item)
at System.Collections.Generic.SynchronizedCollection
1.添加(T项)
在System.ServiceModel.UriSchemeKeyedCollection..ctor(Uri []地址)
在System.ServiceModel.ServiceHost..ctor(类型serviceType,Uri [] baseAddresses)
在System.ServiceModel.Activation.WebServiceHostFactory.CreateServiceHost(类型serviceType,Uri [] baseAddresses)
at System.ServiceModel.Activation.ServiceHostFactory.CreateServiceHost(String constructorString,Uri [] baseAddresses)
在System.ServiceModel.ServiceHostingEnvironment.HostingManager.CreateService(String normalizedVirtualPath)
在System.ServiceModel.ServiceHostingEnvironment.HostingManager.ActivateService(String normalizedVirtualPath)
在System.ServiceModel.ServiceHostingEnvironment.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath)
---内部异常堆栈跟踪结束---
在System.ServiceModel.ServiceHostingEnvironment.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath)
在System.ServiceModel.ServiceHostingEnvironment.EnsureServiceAvailableFast(String relativeVirtualPath)
System.ServiceModel错误:131074:http://msdn.microsoft.com/en-US/library/System.ServiceModel.Diagnostics.EventLog.aspx写入EventLog./LM/W3SVC/703/ROOT-3-129547865876462000WebHost5WebHostFailedToProcessRequest3221356547System.ServiceModel .Activation.HostedHttpRequestAsyncResult / 37535352System.ServiceModel.ServiceActivationException:由于编译期间发生异常,无法激活服务'/ForgetTrafficService.svc'。异常消息是:此集合已包含带有方案http的地址。此集合中每个方案最多只能有一个地址。如果您的服务是在IIS中托管的,则可以通过将'system.serviceModel / serviceHostingEnvironment / multipleSiteBindingsEnabled'设置为true或指定'system.serviceModel / serviceHostingEnvironment / baseAddressPrefixFilters'来解决问题。
参数名称:item。 ---&安培; GT; System.ArgumentException:此集合已包含方案http的地址。此集合中每个方案最多只能有一个地址。如果您的服务是在IIS中托管的,则可以通过将'system.serviceModel / serviceHostingEnvironment / multipleSiteBindingsEnabled'设置为true或指定'system.serviceModel / serviceHostingEnvironment / baseAddressPrefixFilters'来解决问题。
参数名称:item
at System.ServiceModel.UriSchemeKeyedCollection.InsertItem(Int32 index,Uri item)
在System.Collections.Generic.SynchronizedCollection`1.Add(T item)
在System.ServiceModel.UriSchemeKeyedCollection..ctor(Uri []地址)
在System.ServiceModel.ServiceHost..ctor(类型serviceType,Uri [] baseAddresses)
在System.ServiceModel.Activation.WebServiceHostFactory.CreateServiceHost(类型serviceType,Uri [] baseAddresses)
at System.ServiceModel.Activation.ServiceHostFactory.CreateServiceHost(String constructorString,Uri [] baseAddresses)
在System.ServiceModel.ServiceHostingEnvironment.HostingManager.CreateService(String normalizedVirtualPath)
在System.ServiceModel.ServiceHostingEnvironment.HostingManager.ActivateService(String normalizedVirtualPath)
在System.ServiceModel.ServiceHostingEnvironment.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath)
---内部异常堆栈跟踪结束---
在System.Runtime.AsyncResult.End [TAsyncResult](IAsyncResult结果)
在System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result)
答案 0 :(得分:1)
在不知道你得到什么错误的情况下,建议任何事都很困难。我启用了WCF跟踪来进一步解决问题, http://msdn.microsoft.com/en-us/library/ms733025.aspx