我正在维护一个使用WPF服务的应用程序,我之前从未使用过WCF服务,所以我有点挣扎。以下是导致问题的代码摘录:
try
{
// Specify the Enquiry to be retrieved.
getCharterDetails.charterEnquiryId = enquiryID;
getCharterDetails.charterEnquiryIdSpecified = true;
// Build the request object.
request = new ACS.CBS.BusinessDelegates.CharterServices.getCharterDetailsRequest(getCharterDetails);
// Instantiate and call the Service.
CharterServices.charterServiceClient proxy = new CharterServices.charterServiceClient();
using (OperationContextScope scope = this.CreateOperationContext(proxy.InnerChannel)) // <!---hangs here
{
using (proxy as IDisposable)
{
response = proxy.getCharterDetails(getCharterDetails);
}
}
// Extract the Charter Enquiry Object and return it.
return response.@return;
}
catch (FaultException serviceFault)
{
Exception ex = handleServiceFault(serviceFault);
throw ex;
}
它挂在指示的行上,我不知道如何调试WCF服务。有人能指出我正确的方向吗?
提前致谢!
标记
更新
感谢Pankaj,我现在可以通过该行成功创建范围。但是,它现在挂在这一行:
using (charterServiceClientProxy as IDisposable)
{
_ratesOfExchange = proxy.getRateOfExchange(rateOfExchange); // <--- hangs here
}
嗯,它实际上挂在Reference.cs(自动生成的服务引用文件)中。
有什么想法吗?
中号
答案 0 :(得分:0)
更改违规行如下:
using (OperationContextScope scope = new OperationContextScope(proxy.InnerChannel))