Web服务调用排队组件 [英] Web Service calls Queued Component
问题描述
我有一个Web服务,它在
COM +中调用.NET排队的服务组件。我打开了组件的统计信息。我将组件称为
10次,创建了10个对象,但它们并没有消失。我拨打电话后打电话给
Marshal.ReleaseComObject。
[WebMethod]
公共NotifyResponse通知(NotifyRequest) reqMessage)
{
尝试
{
string progid =" MyComponent";
MyComponent =
(IMyComponent)Marshal.BindToMoniker(" queue:/ new:" + progid);
if(MyComponent!= null)
{
MyComponent.Notify(XMLMessage);
}
返回resMessage;
}
catch(例外e)
{
ErrorLog.Log(Severity.Error,异常是
抛出:" + e.Message);
返回resMessage;
}
终于
{
Marshal.ReleaseComObject(MyComponent);
}
}
" BillGatesFan" < kl ****** @ hotmail.comwrote in message
news:11 ********************** @ k79g2000hse .googlegr oups.com ...
>我有一个Web服务,它调用
COM +中的.NET排队服务组件。我打开了组件的统计信息。我将组件称为
10次,创建了10个对象,但它们并没有消失。我拨打电话后打电话给
Marshal.ReleaseComObject。
[WebMethod]
公共NotifyResponse通知(NotifyRequest) reqMessage)
{
尝试
{
string progid =" MyComponent";
MyComponent =
(IMyComponent)Marshal.BindToMoniker(" queue:/ new:" + progid);
if(MyComponent!= null)
{
MyComponent.Notify(XMLMessage);
}
返回resMessage;
}
catch(例外e)
{
ErrorLog.Log(Severity.Error,异常是
抛出:" + e.Message);
返回resMessage;
}
终于
{
Marshal.ReleaseComObject(MyComponent);
}
}
你的班级派生于IDisposable(ServicedComponent)所以你必须
" dispose"完成后,也就是说,你需要调用MyComponent .Dispose()或使用
使用成语。
using(Mycomponent = ...)
{
//使用组件......
} //这隐含地调用Dispose
Willy。
" Willy Denoyette [MVP]" < wi ************* @ telenet.bewrote in message
news:eq ************** @ TK2MSFTNGP03。 phx.gbl ...
" BillGatesFan" < kl ****** @ hotmail.comwrote in message
news:11 ********************** @ k79g2000hse .googlegr oups.com ...
>>我有一个Web服务,它调用COM +中的.NET排队服务组件。我打开了组件的统计信息。我将组件称为10次,创建了10个对象,但它们并没有消失。我打完每个电话后都打电话给Marshal.ReleaseComObject。
[WebMethod]
公共NotifyResponse通知(NotifyRequest reqMessage)
{
尝试
{/ /> string progid =" MyComponent";
MyComponent =
(IMyComponent)Marshal.BindToMoniker(" queue:/ new:" + progid);
if(MyComponent!= null)
{
MyComponent.Notify(XMLMessage);
}
返回resMessage;
}
catch(例外e)
{ErrorLog.Log(Severity.Error,抛出异常:" + e.Message);
返回resMessage;
}
最后
{Marshal.ReleaseComObject(MyComponent);
}
}
你的类派生自IDisposable(ServicedComponent)所以你必须
" dispose"完成后,也就是说,你需要调用MyComponent .Dispose()或
使用习惯用法。
使用(Mycomponent = ...)
{
//使用组件......
} //这隐含地调用Dispose
Willy。
抱歉,我错过了Moniker,你有效地获得了一个COM包装器,所以你需要
调用ReleaseComObject。
需要调查一下,完成后我会回来的。
Willy。
11月8日下午12:39,Willy Denoyette [MVP]
< willy.denoye ... @ telenet.bewrote:
< blockquote class =post_quotes>
" Willy Denoyette [MVP]" < willy.denoye ... @ telenet.bewrote in messagenews:eq ************** @ TK2MSFTNGP03.phx.gbl。 ..
" BillGatesFan" < klj_m ... @ hotmail.comwrote in message
news:11 ********************** @ k79g2000hse.googlegr oups .com ...
>我有一个Web服务,它调用
COM +中的.NET排队服务组件。我打开了组件的统计信息。我将组件称为
10次,创建了10个对象,但它们并没有消失。我打完每个电话后打电话给
Marshal.ReleaseComObject。
[WebMethod]
public NotifyResponse Notify(NotifyRequest reqMessage)
{
试试
{
string progid =" MyComponent";
MyComponent =
(IMyComponent)Marshal.BindToMoniker(" queue:/ new:" + progid);
if(MyComponent!= null)
{
MyComponent.Notify(XMLMessage);
}
返回resMessage;
} < br $>
catch(例外e)
{
ErrorLog.Log(Severity.Error,异常是
抛出:" + e.Message);
返回resMessage;
}
终于
{
Marshal.ReleaseComObject(MyComponent);
}
}
你的类派生自IDisposable(ServicedComponent)所以你必须
dispose完成后,也就是说,你需要调用MyComponent .Dispose()或
使用习惯用法。
使用(Mycomponent = ...)
{
//使用组件...
} //这隐式调用Dispose
威利。
抱歉,我错过了Moniker,你有效地获得了一个COM包装器,所以你需要调用ReleaseComObject来获得
。
需要调查一下,完成后我会回来的。
Willy.-隐藏引用的文字 -
- 显示引用的文字 -
非常感谢!我会晕厥
I have a web service which calls a .NET queued serviced component in
COM+. I turned statistics on for the component. I call the component
10 times, 10 objects get created but they do not go away. I''m calling
Marshal.ReleaseComObject after I make each call.
[WebMethod]
public NotifyResponse Notify(NotifyRequest reqMessage)
{
try
{
string progid = "MyComponent";
MyComponent=
(IMyComponent)Marshal.BindToMoniker("queue:/new:" + progid);
if ( MyComponent != null)
{
MyComponent.Notify(XMLMessage);
}
return resMessage;
}
catch (Exception e)
{
ErrorLog.Log(Severity.Error, "An exception was
thrown:" + e.Message);
return resMessage;
}
finally
{
Marshal.ReleaseComObject(MyComponent);
}
}
"BillGatesFan" <kl******@hotmail.comwrote in message
news:11**********************@k79g2000hse.googlegr oups.com...>I have a web service which calls a .NET queued serviced component in
COM+. I turned statistics on for the component. I call the component
10 times, 10 objects get created but they do not go away. I''m calling
Marshal.ReleaseComObject after I make each call.
[WebMethod]
public NotifyResponse Notify(NotifyRequest reqMessage)
{
try
{
string progid = "MyComponent";
MyComponent=
(IMyComponent)Marshal.BindToMoniker("queue:/new:" + progid);
if ( MyComponent != null)
{
MyComponent.Notify(XMLMessage);
}
return resMessage;
}
catch (Exception e)
{
ErrorLog.Log(Severity.Error, "An exception was
thrown:" + e.Message);
return resMessage;
}
finally
{
Marshal.ReleaseComObject(MyComponent);
}
}
Your class derives from an IDisposable (ServicedComponent) so you have to
"dispose" when done, that is, you need to call MyComponent .Dispose() or use
the using idiom.
using (Mycomponent = ...)
{
// use the component...
} //this implicitly calls Dispose
Willy.
"Willy Denoyette [MVP]" <wi*************@telenet.bewrote in message
news:eq**************@TK2MSFTNGP03.phx.gbl..."BillGatesFan" <kl******@hotmail.comwrote in message
news:11**********************@k79g2000hse.googlegr oups.com...>>I have a web service which calls a .NET queued serviced component in
COM+. I turned statistics on for the component. I call the component
10 times, 10 objects get created but they do not go away. I''m calling
Marshal.ReleaseComObject after I make each call.
[WebMethod]
public NotifyResponse Notify(NotifyRequest reqMessage)
{
try
{
string progid = "MyComponent";
MyComponent=
(IMyComponent)Marshal.BindToMoniker("queue:/new:" + progid);
if ( MyComponent != null)
{
MyComponent.Notify(XMLMessage);
}
return resMessage;
}
catch (Exception e)
{
ErrorLog.Log(Severity.Error, "An exception was
thrown:" + e.Message);
return resMessage;
}
finally
{
Marshal.ReleaseComObject(MyComponent);
}
}
Your class derives from an IDisposable (ServicedComponent) so you have to
"dispose" when done, that is, you need to call MyComponent .Dispose() or
use the using idiom.
using (Mycomponent = ...)
{
// use the component...
} //this implicitly calls Dispose
Willy.
Sorry, I missed the Moniker, you effectively get a COM wrapper back, so you
need to call ReleaseComObject.
Need to investigate this a bit, i''ll come back when done.
Willy.
On Nov 8, 12:39 pm, "Willy Denoyette [MVP]"
<willy.denoye...@telenet.bewrote:"Willy Denoyette [MVP]" <willy.denoye...@telenet.bewrote in messagenews:eq**************@TK2MSFTNGP03.phx.gbl. ..
"BillGatesFan" <klj_m...@hotmail.comwrote in message
news:11**********************@k79g2000hse.googlegr oups.com...>I have a web service which calls a .NET queued serviced component in
COM+. I turned statistics on for the component. I call the component
10 times, 10 objects get created but they do not go away. I''m calling
Marshal.ReleaseComObject after I make each call.
[WebMethod]
public NotifyResponse Notify(NotifyRequest reqMessage)
{
try
{
string progid = "MyComponent";
MyComponent=
(IMyComponent)Marshal.BindToMoniker("queue:/new:" + progid);
if ( MyComponent != null)
{
MyComponent.Notify(XMLMessage);
}
return resMessage;
}
catch (Exception e)
{
ErrorLog.Log(Severity.Error, "An exception was
thrown:" + e.Message);
return resMessage;
}
finally
{
Marshal.ReleaseComObject(MyComponent);
}
}
Your class derives from an IDisposable (ServicedComponent) so you have to
"dispose" when done, that is, you need to call MyComponent .Dispose() or
use the using idiom.
using (Mycomponent = ...)
{
// use the component...
} //this implicitly calls Dispose
Willy.
Sorry, I missed the Moniker, you effectively get a COM wrapper back, so you
need to call ReleaseComObject.
Need to investigate this a bit, i''ll come back when done.
Willy.- Hide quoted text -
- Show quoted text -Thanks so much! I''ll be wainting
这篇关于Web服务调用排队组件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!