Link to home
Start Free TrialLog in
Avatar of fkmfkm
fkmfkm

asked on

COM+ Application Libary/Server Activation

I have created a serviced component using VB.NET. I have set the Actication type to Library and create a test application using normal exe. It works..

But when I call it from ASP.NET it fails with the following error :=

Server Error in '/WebApplication1' Application.
--------------------------------------------------------------------------------

Access is denied.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.UnauthorizedAccessException: Access is denied.

The ASP.NET process is not authorized to access the requested resource. For security reasons the default ASP.NET process identity is '{machinename}\ASPNET', which has limited privileges. Consider granting access rights to the resource to the ASP.NET process identity.

To grant ASP.NET write access to a file, right-click the file in Explorer, choose "Properties" and select the Security tab. Click "Add" to add the "{machinename}\ASPNET" user. Highlight the ASP.NET account, and check the Write box in the Allow column.

Source Error:


Line 25:         Dim a As ClassLibrary1.Poolable
Line 26:
Line 27:         a = New ClassLibrary1.Poolable()
Line 28:     End Sub
Line 29: End Class
 

Source File: c:\inetpub\wwwroot\WebApplication1\WebForm1.aspx.vb    Line: 27

Stack Trace:


[UnauthorizedAccessException: Access is denied.]
   System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(Int32 errorCode, IntPtr errorInfo) +0
   System.EnterpriseServices.Thunk.Proxy.CoCreateObject(Type serverType, Boolean bQuerySCInfo, Boolean& bIsAnotherProcess, String& uri) +587
   System.EnterpriseServices.ServicedComponentProxyAttribute.CreateInstance(Type serverType) +181
   System.Runtime.Remoting.Activation.ActivationServices.CreateInstanceWithLinkDemand(ProxyAttribute pa, Type serverType) +4
   System.Runtime.Remoting.Activation.ActivationServices.IsCurrentContextOK(Type serverType, Object[] props) +122
   WebApplication1.WebForm1.Button1_Click(Object sender, EventArgs e) in c:\inetpub\wwwroot\WebApplication1\WebForm1.aspx.vb:27
   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
   System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +57
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +18
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
   System.Web.UI.Page.ProcessRequestMain() +1263

 
I tried changing the Activation to Server and the page works. Why is this happening ? How can I make it work again ? thank you very much..

Need your help..
Avatar of CarlosMu
CarlosMu

Basically the answer to your question lies in the statmenent.

The ASP.NET process is not authorized to access the requested resource. For security reasons the default ASP.NET process identity is '{machinename}\ASPNET', which has limited privileges. Consider granting access rights to the resource to the ASP.NET process identity.

When you run the component from a windows application it is running under the user id of the person log on the machine. That person (you) has the rights to run such an application.  When you run an asp page the process must run under a user id, but since any user migth be accesing the page the user asigned to the page has limited authority.  What you have to do is to assign the proper authority to the dll.  Unfortunately, I have not yet reach that chapter on my book.
ASKER CERTIFIED SOLUTION
Avatar of GoodJun
GoodJun

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
u can change the machine.config file
and changin 'machine' to 'SYSTEM'
and it will work
Avatar of fkmfkm

ASKER

How should i give the points to GoodJun and yosit ?
Did you solved your problem? If not, we can guide you through to make it work.

cheers,
Avatar of fkmfkm

ASKER

How if I am doing normal ASP 3.0 pages ?
asp 3.0 also support impersonation.
Thanks for the grade.