I am getting the exception below in my web application: "The communication object, System.ServiceModel.Channels.ServiceChannel, cannot be used for communication because it is in the Faulted state" Stack Trace:
" Server stack trace: at System.ServiceModel.Channels.CommunicationObject.Close(TimeSpan timeout) 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 System.ServiceModel.ICommunicationObject.Close(TimeSpan timeout)
at 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(Object instance) at System.Web.UI.WebControls.ObjectDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) at System.Web.UI.WebControls.ObjectDataSource.Select() at BudgeteerWeb.EditTransaction.Page_Load(Object sender, EventArgs e) in C:\Develop\Budgeteer\BudgeteerWeb\BudgeteerWeb\MemberPages\Transactions\Edit.aspx.vb:line 27"
I am calling a WCF Service from within a select method used by a ObjectDataSource. Everything works OK if I'm not using message-based security. But as soon as I turn on the wsHttpBinding with the ClientCredentials, I get the above error. Not sure what I'm missing.
ASP Code:
Code Behind: Function That is used by objectDataSource select method:
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
Thanks in advance.