Groups | Blog | Home
all groups > dotnet component services > september 2005 >

dotnet component services : Access to the registry key HKEY_CLASSES_ROOT\EntSrvcTest1_direct.Global is denied



z f
9/15/2005 12:00:00 AM
Hi,

using enterprise services from dot-net:

on windows application it did OK.
on ASP.NET i get the folowing error. (see in the end)

Access to the registry key HKEY_CLASSES_ROOT\EntSrvcTest1_direct.Global is
denied

if i use the components services MMC snap in to create a new application
with the required DLL, the ASP.NET call does fine.

what are the steps in order for the ASP.NET process to make the COM+
(enterprise services) registration successfully as a windows application?
should this be the way?
or should it be pre-configured in the com+ catalog? and if so what is the
recomended way to use a command line tool for this?

also is there some XP/Win2003 server differences that should be considered?

TIA!








Server Error in '/EntSrvcTest1-direct' Application.
--------------------------------------------------------------------------------

Access to the registry key HKEY_CLASSES_ROOT\EntSrvcTest1_direct.Global 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 to the
registry key HKEY_CLASSES_ROOT\EntSrvcTest1_direct.Global is denied.

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 write 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 45:
Line 46: Private Sub Button1_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles Button1.Click
Line 47: Dim oTran As New cTran
Line 48: oTran.MakeChange()
Line 49:


Source File: c:\inetpub\wwwroot\EntSrvcTest1-direct\WebForm1.aspx.vb
Line: 47

Stack Trace:


[UnauthorizedAccessException: Access to the registry key
HKEY_CLASSES_ROOT\EntSrvcTest1_direct.Global is denied.]
Microsoft.Win32.RegistryKey.Win32Error(Int32 errorCode, String str) +74
Microsoft.Win32.RegistryKey.CreateSubKey(String subkey) +503
System.Runtime.InteropServices.RegistrationServices.RegisterManagedType(Type
type, String strAsmName, String strAsmVersion, String strAsmCodeBase, String
strRuntimeVersion) +216
System.Runtime.InteropServices.RegistrationServices.RegisterAssembly(Assembly
assembly, AssemblyRegistrationFlags flags) +258
System.EnterpriseServices.RegistrationDriver.ClassicRegistration(Assembly
asm) +100

[RegistrationException: Failed to register assembly 'EntSrvcTest1-direct,
Version=1.0.2084.17791, Culture=neutral, PublicKeyToken=1734505f1056dd4f'.]
System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage
reqMsg, IMessage retMsg) +264
System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&
msgData, Int32 type) +877
System.EnterpriseServices.RegistrationHelperTx.InstallAssemblyFromConfig(RegistrationConfig&
regConfig, Object sync) +0
System.EnterpriseServices.RegistrationHelper.TryTransactedInstall(RegistrationConfig
regConfig) +215
System.EnterpriseServices.RegistrationHelper.InstallAssemblyFromConfig(RegistrationConfig&
regConfig) +241
System.EnterpriseServices.RegistrationHelper.InstallAssembly(String
assembly, String& application, String partition, String& tlb,
InstallationFlags installFlags) +116
System.EnterpriseServices.RegistrationHelper.InstallAssembly(String
assembly, String& application, String& tlb, InstallationFlags installFlags)
+19
System.EnterpriseServices.RegistrationHelper.System.EnterpriseServices.Thunk.IThunkInstallation.DefaultInstall(String
asm) +43
System.EnterpriseServices.Thunk.Proxy.RegisterAssembly(Assembly assembly)
+99
System.EnterpriseServices.Thunk.Proxy.LazyRegister(Guid id, Type
serverType, Boolean checkCache) +200
System.EnterpriseServices.Thunk.Proxy.CoCreateObject(Type serverType,
Boolean bQuerySCInfo, Boolean& bIsAnotherProcess, String& uri) +215
System.EnterpriseServices.ServicedComponentProxyAttribute.CreateInstance(Type
serverType) +181
System.Runtime.Remoting.Activation.ActivationServices.IsCurrentContextOK(Type
serverType, Object[] props, Boolean bNewObj) +74
EntSrvcTest1_direct.WebForm1.Button1_Click(Object sender, EventArgs e) in
c:\inetpub\wwwroot\EntSrvcTest1-direct\WebForm1.aspx.vb:47
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() +1292





--------------------------------------------------------------------------------

Version Information: Microsoft .NET Framework Version:1.1.4322.2032; ASP.NET
Version:1.1.4322.2032


Cowboy (Gregory A. Beamer) - MVP
9/15/2005 5:49:25 AM
The problem deals with the fact that ASP.NET uses the anon user by default,
who does not have access to your registry (for good reason). This means you
either have to have the user log on (and have an account with registry
access) or you have to get around it.

To get around, the easiest way is to set up the registry access assembly in
COM+. The ASP.NET app can hit the registry access objects, which can run
under any account you set them up under. The downsides to this approach are
the addition of both COM+ and some interop as well as the added need to keep
called .NET components signed and in the GAC. If the registry access is
separate and down the chain, this is a minor issue.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************


[quoted text, click to view]
AddThis Social Bookmark Button