我在我的网络应用程序中收到以下异常: “通信对象System.ServiceModel.Channels.ServiceChannel不能用于通信,因为它处于Faulted状态” 堆栈跟踪:
“服务器堆栈跟踪:at System.ServiceModel.Channels.CommunicationObject.Close(时间跨度 timeout)在[0]处重新抛出异常:at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(即时聊天 reqMsg,IMessage retMsg)at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&安培; msgData,Int32类型)at System.ServiceModel.ICommunicationObject.Close(TimeSpan timeout)
在 System.ServiceModel.ClientBase1.System.ServiceModel.ICommunicationObject.Close(TimeSpan timeout) at System.ServiceModel.ClientBase
1.Close()at System.ServiceModel.ClientBase`1.System.IDisposable.Dispose()at System.Web.UI.WebControls.ObjectDataSourceView.ReleaseInstance(对象 例子) System.Web.UI.WebControls.ObjectDataSourceView.ExecuteSelect(DataSourceSelectArguments System.Web.UI.WebControls.ObjectDataSource.Select()上的参数) 在BudgeteerWeb.EditTransaction.Page_Load(对象发件人,EventArgs e) 在 C:\开发\预算制订\ BudgeteerWeb \ BudgeteerWeb \ MemberPages \交易\ Edit.aspx.vb:线 27"
我从ObjectDataSource使用的select方法中调用WCF服务。如果我没有使用基于消息的安全性,一切正常。但是一旦我使用ClientCredentials打开wsHttpBinding,我就会收到上述错误。不确定我错过了什么。
ASP代码:
代码背后: objectDataSource选择方法使用的函数:
Protected Function getTransaction(ByVal userID As String, ByVal transactionID As Int64)
As BudgeteerService.Transaction
Dim transaction As BudgeteerService.Transaction = New BudgeteerService.Transaction
transaction = wcfProxy.GetTransaction(userID, transactionID)
Return transaction
End Function
Try
transactionID = Int64.Parse(Request.QueryString("TransactionID"))
Dim userIdParm As Parameter = New Parameter
TransactionDataSource.Select() '**EXCEPTION GETS THROWN HERE**
FormView1.DataSource = TransactionDataSource
FormView1.DataBind()
Catch timeOutEx As TimeoutException
Throw timeOutEx
Catch comEx As CommunicationException
Throw comEx
Catch ex As Exception
Throw New Exception("An error occured while trying to retrieve this transaction")
End Try
提前致谢。