Hello guys. I have a problem, I tried everything with no luck. I want to create a .NET C# Class Library (DLL) then expose this to COM+ and finally reuse it from ASP .NET What I've done until now: - creating my DLL, derive the main class from System.EnterpriseServices.ServicedComponent, then adding the right attributes - in Project Properties I made my Assembly COM visible - strong named my DLL, generating a key necessary to register my DLL in GAC, global assembly cache ( sn -k AccountManager.key) - regiter my DLL in GAC with C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bin>gacutil /i D:\Projects\WG\Import\BLL\bin\Debug\WgComImport.dll - regiter my DLL as COM+ component using C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727>regsvcs /fc D:\Projects\WG\Import\BLL\bin\Debug\WgComImport.dll
All good until now, my COM+ object appear on GAC folder (C:\WINDOWS\assembly) and in Settings->Administrative Tools -> Component Services-> My Computer-> COM+ Application
Note that my bin/DebuMyLibrary.dll registered as COM+ object is unique, strong named, versioned, GAC accessible, COM+ registered. That means this DLL can be copied anywhere in my computer, added as Reference to any .NET project, instantiated and XP or OS know that this is a COM+ object and any called method should run properly, in my COM+ application.
Running COM+ methods from ASP .NET should not request for user permissions. What I do wrong?
The problem is that when used from ASP .NET my DLL gives this error:
Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)) 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. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
ASP.NET is not authorized to access the requested resource. Consider granting access rights to the resource to the ASP.NET request identity. ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS 5 or Network Service on IIS 6) that is used if the application is not impersonating. If the application is impersonating via <identity impersonate="true"/>, the identity will be the anonymous user (typically IUSR_MACHINENAME) or the authenticated request user.
To grant ASP.NET access to a file, right-click the file in Explorer, choose "Properties" and select the Security tab. Click "Add" to add the appropriate user or group. Highlight the ASP.NET account, and check the boxes for the desired access.
Source Error:
Line 28: public void uploadButton_Click(object sender, EventArgs e) Line 29: { Line 30: ImportWatcher iw = new ImportWatcher(); Line 31: } Line 32:
22 years, Romania, Bucharest
Moved byLinChenMonday, May 18, 2009 8:20 PMThis question seems more related to .NET development (From:Transactions Programming)
Moved bynobugzTuesday, May 19, 2009 12:57 AMforums.asp.net or forums.iis.net (From:.NET Base Class Library)