У меня служба WCF Rest на .Net 4.0, и эта служба работает хорошо, когда я использую мой локальный IIS 7.5.Но у меня есть пакет веб-хостинга, когда я публикую сервис для них, получаю сообщение об ошибке, в котором подробно описывается тип ошибки. Ранее я публиковал другие виды сервисов WCF в .Net 4.0, и это нормально.Компания, которая развертывает сервис, - это 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 исключение ./LM/W3SVC/703/ROOT-3-129547865876462000System.ArgumentException, mscorlib, Версия = 4.0.0.0, Культура = нейтральная, PublicKeyToken = b77a5c56190eуже содержит адрес со схемой http.В этой коллекции может быть не более одного адреса на схему.Если ваша служба размещается в IIS, вы можете решить эту проблему, установив 'system.serviceModel / serviceHostingEnvironment / multipleSiteBindingsEnabled' в значение true или указав 'system.serviceModel / serviceHostingEnvironment / baseAddressPrefixFilters'.Имя параметра: элемент в System.ServiceModel.UriSchemeKeyedCollection.InsertItem (индекс Int32, элемент Uri) в 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.Add (T item) в System.ServiceModel.UriSchemeKeyedCollection..ctor (Uri]адреса) в System.ServiceModel.ServiceHost..ctor (тип serviceType, Uri [] baseAddresses) в System.ServiceModel.Activation.WebServiceHostFactory.CreateServiceHost (тип serviceType, Uri [] baseAddresses) в System.ServiceModeloster.Hervice.Hervice.Hervice.Hervice.Hervice.Hervice.Hervice.Hervice.Hervice.Hervice.Service.HerviceСтрока 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.aspxWrote в 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'.Имя параметра: элемент.---> System.ArgumentException: эта коллекция уже содержит адрес со схемой http.В этой коллекции может быть не более одного адреса на схему.Если ваша служба размещается в IIS, вы можете решить эту проблему, установив 'system.serviceModel / serviceHostingEnvironment / multipleSiteBindingsEnabled' в значение true или указав 'system.serviceModel / serviceHostingEnvironment / baseAddressPrefixFilters'.Имя параметра: элемент в System.ServiceModel.UriSchemeKeyedCollection.InsertItem (индекс Int32, элемент Uri) в System.Collections.Generic.SynchronizedCollection`1.Add (T item) в System.ServiceModel.UriSchemeKeyedCollection..ctor (адреса Uri [])at System.ServiceModel.ServiceHost..ctor (Тип serviceType, Uri [] baseAddresses)в System.ServiceModel.Activation.WebServiceHostFactory.CreateServiceHost (Тип serviceType, Uri [] baseAddresses) в System.ServiceModel.Activation.ServiceHostFactory.CreateServiceHost (String constructorString.erl.normalizedVirtualPath) в System.ServiceModel.ServiceHostingEnvironment.HostingManager.ActivateService (String normalizedVirtualPath) в System.ServiceModel.ServiceHostingEnvironment.HostingManager.[TAsyncResult] (результат IAsyncResult) в System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End (результат IAsyncResult)