也許你可以幫助我,因爲我在這裏真的很茫然。託管WCF時發生服務器錯誤
我想在子域上的IIS上託管我的WCF服務。
開始,這裏是我的文件結構:
http://s18.postimage.org/eqmjxb00n/Serv.jpg
垃圾桶裏面是代表我的界面我.dll和它的實現。
這裏是web.config文件:
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="false" targetFramework="4.0" />
</system.web>
<system.serviceModel>
<services>
<service name="AuthenticatorService.Authenticator">
<endpoint address="" binding="basicHttpBinding" bindingConfiguration=""
name="AuthEndpoint" contract="AuthInterface.IAuthenticator" />
<endpoint address="" binding="mexHttpBinding" name="MetadataEndpoint"
contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="True"/>
<serviceDebug includeExceptionDetailInFaults="False" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>
它本地工作,但是當我上傳到IIS它只是給500服務器錯誤。
謝謝!
如果它在這裏的任何使用是從詳細的錯誤頁面的消息:
Module ServiceModel-4.0
Notification AuthenticateRequest
Handler svc-Integrated-4.0
Error Code 0x00000000
Requested URL http://service.swiftposter.com:80/auth.svc
Logon Method Anonymous
Logon User Anonymous
編輯:我啓用ELMAH記錄和終於拿到了meaningfull消息:
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
我就要開始研究這個錯誤,但我在這裏發佈,以防萬一有人知道什麼是錯的。
堆棧跟蹤:
System.ServiceModel.ServiceActivationException: The service '/auth.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. ---> 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)
at System.ServiceModel.UriSchemeKeyedCollection..ctor(Uri[] addresses)
at System.ServiceModel.ServiceHost..ctor(Type serviceType, Uri[] baseAddresses)
at System.ServiceModel.Activation.ServiceHostFactory.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)
--- End of inner exception stack trace ---
at System.Runtime.AsyncResult.End[TAsyncResult](IAsyncResult result)
at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result)
at System.ServiceModel.Activation.ServiceHttpModule.EndProcessRequest(IAsyncResult ar)
at System.Web.HttpApplication.AsyncEventExecutionStep.OnAsyncEventCompletion(IAsyncResult ar)
在IIS中部署時沒有任何反應?你在問題標題中提到了500個服務器錯誤。你能告訴我們更多一點嗎? – 2012-03-30 10:14:50
對不起,沒有任何反應,我的意思是它沒有運行。它只是不斷給我500服務器錯誤。 – TheGateKeeper 2012-03-30 10:17:33
是。淨版本的應用程序池定義的權限是文件/數據庫使用正確的憑據發佈(如果適用)。問題可能是問題。你有更多的信息嗎? – 2012-03-30 10:30:15