我在相同的解決方案中設置了以下內容。在ASP.NET Web應用程序中將WCF服務庫連接問題發佈到DAL
- 一個WCF服務,稱爲MatchService.cs
- 一個DAL與EntityDataModel我班一個主要服務以檢索我的關於足球的資料庫從DB
- 一個ASP.NET網站,該網站託管匹配WCF服務庫匹配服務(來自上面提到的WCF服務庫)
我的問題是,這個罰款在本地運行,但不在生產服務器上運行。本地WCF項目有一個app.config從中獲取DB DAL的連接詳細信息,但是我認爲這不會被放入WCF服務項目的編譯.dll中,因爲當我遇到以下錯誤時將其上傳到生產站點:
「通信對象System.ServiceModel.Channels.ServiceChannel不能用於通信,因爲它處於Faulted狀態。」
所以我認爲它會嘗試從web.config中獲取數據庫詳細信息,但是這似乎也不是這種情況。
任何人都可以讓我知道我做錯了什麼嗎?
編輯:
我現在已經刪除了所有嘗試訪問DAL和進出口仍無法通過WCF測試客戶端訪問服務時,服務的託管環境。 WCF測試客戶端在我的本地機器上。我可以然而這些方法出現在WCF測試客戶端,當我嘗試調用它們,我得到以下錯誤之一:
The caller was not authenticated by the service.
Server stack trace:
at System.ServiceModel.Security.IssuanceTokenProviderBase`1.DoNegotiation(TimeSpan timeout)
at System.ServiceModel.Security.SspiNegotiationTokenProvider.OnOpen(TimeSpan timeout)
at System.ServiceModel.Security.WrapperSecurityCommunicationObject.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at System.ServiceModel.Security.CommunicationObjectSecurityTokenProvider.Open(TimeSpan timeout)
at System.ServiceModel.Security.SymmetricSecurityProtocol.OnOpen(TimeSpan timeout)
at System.ServiceModel.Security.WrapperSecurityCommunicationObject.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at System.ServiceModel.Channels.SecurityChannelFactory`1.ClientSecurityChannel`1.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at System.ServiceModel.Security.SecuritySessionSecurityTokenProvider.DoOperation(SecuritySessionOperation operation, EndpointAddress target, Uri via, SecurityToken currentToken, TimeSpan timeout)
at System.ServiceModel.Security.SecuritySessionSecurityTokenProvider.GetTokenCore(TimeSpan timeout)
at System.IdentityModel.Selectors.SecurityTokenProvider.GetToken(TimeSpan timeout)
at System.ServiceModel.Security.SecuritySessionClientSettings`1.ClientSecuritySessionChannel.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.OnOpen(TimeSpan timeout)
at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.CallOpenOnce.System.ServiceModel.Channels.ServiceChannel.ICallOnce.Call(ServiceChannel channel, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.CallOnceManager.CallOnce(TimeSpan timeout, CallOnceManager cascade)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at IMatchService.GetMatches()
at MatchServiceClient.GetMatches()
Inner Exception:
The request for security token could not be satisfied because authentication failed.
at System.ServiceModel.Security.SecurityUtils.ThrowIfNegotiationFault(Message message, EndpointAddress target)
at System.ServiceModel.Security.SspiNegotiationTokenProvider.GetNextOutgoingMessageBody(Message incomingMessage, SspiNegotiationTokenProviderState sspiState)
你能通過瀏覽器導航到你的WCF服務嗎?拿到終點地址,看看它是否會出現在瀏覽器中。 –
是的,我可以導航到瀏覽器中的服務,但是我無法訪問瀏覽器中的方法?我不能把地址放在這裏,但我可以轉達任何需要的信息。 – Kevin
您的servicemodel配置位需要位於您的主機項目的web.config中。他們? –