Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Component Services / August 2007

Tip: Looking for answers? Try searching our database.

ASP 3.0 not releasing objects to pool (Windows 2003 Server)

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
jmzl666 - 01 Aug 2007 00:24 GMT
Hi all,  i have a COM+ component that works great from ASP.NET but in
ASP the objects are not released in Windows 2003, the same code runs
ok on my testing machine (Windows XP), I'm using the framework version
1.1.4322.573, every time i create an object the activated column in
the component services snap in adds one, but it never release it, here
is the code of my component.

[Guid("D22B554F-FE25-45af-B80C-80ACD8CE3DB6")]
[ClassInterface(ClassInterfaceType.None)]
[ProgId("CNBV_SAIT_AUTENTICA.ValidateUserServiced")]
[ObjectPooling(MinPoolSize = 5,MaxPoolSize = 50)]
[JustInTimeActivation(true)]
[ComVisible(true)]
[EventTrackingEnabled(true)]
public class ValidateUserServiced: ServicedComponent,IValidateUser{
 protected override bool CanBePooled() {
   return(true);
 }
 [SecurityPermission(SecurityAction.Demand, ControlPrincipal=true,
UnmanagedCode=true)]
 [AutoComplete(true)]
 public bool IsValidD(string userId, string password,string domain){
   if(General.IsEmpty(userId)){
    throw new
ArgumentNullException("userId",General.stringManager.GetString(
     "userIdArgumentNullException", CultureInfo.CurrentUICulture));
   }
   if(General.IsEmpty(password)){
     throw new
ArgumentNullException("password",General.stringManager.GetString(
    "passwordArgumentNullException", CultureInfo.CurrentUICulture));
   }
   if(General.IsEmpty(domain)){
     throw new
ArgumentNullException("domain",General.stringManager.GetString(
    "domainArgumentNullException", CultureInfo.CurrentUICulture));
   }
   IntPtr token= IntPtr.Zero;
   try{
     token= IntPtr.Zero;
     if(!NativeMethods.LogOnUser(userId, General.GetDomain(domain),
password,
       General.LOGON32_LOGON_INTERACTIVE,
    General.LOGON32_PROVIDER_DEFAULT, ref token)){
    return(false);
     }
     return(true);
   }
   finally{
     if(!token.Equals(IntPtr.Zero)){
       NativeMethods.CloseHandle(token);
     }
   }
 }
}

Here is the code i use to call the component:

Public Function ValidaUsuario(usuario,password)
 Dim ObjValida
 on error resume next
 Set
objValida=Server.CreateObject("CNBV_SAIT_AUTENTICA.ValidateUserServiced")
 ValidaUsuario=objValida.IsValidDG(usuario, password,
Application("Dominio"),Application("Grupo"))
 if Err.Number <> 0 then
   ValidaUsuario = -3
   Err.Clear
 end if
 set objValida=nothing
End Function

As you can see, I use JITA, autocomplete, on my machine this code runs
ok, but in windows 2003 the activated objects get to 50 and never go
down (application debugging is disabled in IIS), thanks in advanced.

Juan Zamudio
Egil Hogholt - 03 Aug 2007 15:12 GMT
> Hi all,  i have a COM+ component that works great from ASP.NET but in
> ASP the objects are not released in Windows 2003, the same code runs
> ok on my testing machine (Windows XP), I'm using the framework version
> 1.1.4322.573, every time i create an object the activated column in
> the component services snap in adds one, but it never release it, here
> is the code of my component.

Try to add this in your finally block:
   ContextUtil.DeactivateOnReturn = true;    ContextUtil.SetComplete();

Cheers,
Egil
http://www.egilh.com/

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.