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

  • Thread starter Dominick Baier [DevelopMentor]
  • Start date
D

Dominick Baier [DevelopMentor]

Hello z,

yes you have to pre-register the COM+ component - annotate as much as possible
with attributes in your ServicedComponent and use regsvcs.exe from the command
line at install time.
---------------------------------------
Dominick Baier - DevelopMentor
http://www.leastprivilege.com
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.RegisterManagedTyp
e(Type
type, String strAsmName, String strAsmVersion, String strAsmCodeBase,
String
strRuntimeVersion) +216

System.Runtime.InteropServices.RegistrationServices.RegisterAssembly(A
ssembly
assembly, AssemblyRegistrationFlags flags) +258

System.EnterpriseServices.RegistrationDriver.ClassicRegistration(Assem
bly
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.InstallAssemblyFromConf
ig(RegistrationConfig&
regConfig, Object sync) +0

System.EnterpriseServices.RegistrationHelper.TryTransactedInstall(Regi
strationConfig
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.CreateInstan
ce(Type
serverType) +181

System.Runtime.Remoting.Activation.ActivationServices.IsCurrentContext
OK(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.R
aisePostBackEvent(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
----------------------------------------------------------------------
 
Z

z f

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
 
C

Cowboy (Gregory A. Beamer) - MVP

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!
***************************


z f said:
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
 
D

Dominick Baier [DevelopMentor]

Hello Cowboy (Gregory A. Beamer) - MVP,

if auto registration happens in ASP.NET not the anon but the workerp process
account is used. But still this account is not privilege enough to do the
registration. I don't see ANY point in doing auto reg in web applications.

just run regsvcs at install time and party on.

---------------------------------------
Dominick Baier - DevelopMentor
http://www.leastprivilege.com
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.

***************************
Think Outside the Box!
***************************
z f said:
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.RegisterManagedTy
pe(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(Asse
mbly asm) +100

[RegistrationException: Failed to register assembly
'EntSrvcTest1-direct,

Version=1.0.2084.17791, Culture=neutral,
PublicKeyToken=1734505f1056dd4f'.]

System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessag
e

reqMsg, IMessage retMsg) +264

System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&

msgData, Int32 type) +877

System.EnterpriseServices.RegistrationHelperTx.InstallAssemblyFromCon
fig(RegistrationConfig&

regConfig, Object sync) +0

System.EnterpriseServices.RegistrationHelper.TryTransactedInstall(Reg
istrationConfig

regConfig) +215

System.EnterpriseServices.RegistrationHelper.InstallAssemblyFromConfi
g(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.EnterpriseService
s.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.CreateInsta
nce(Type

serverType) +181

System.Runtime.Remoting.Activation.ActivationServices.IsCurrentContex
tOK(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

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,516
Members
44,984
Latest member
PeakCBDGummiesReview

Latest Threads

Top