J
jmzl666
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
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