.NETGURU
Debugging a c# serviced component
Messages   Related Types
This message was discovered on microsoft.public.dotnet.languages.csharp.
Responses highlighted in red are from those people who are likely to be able to contribute good, authoratitive information to this discussion. They include Microsoft employees, MVP's and others who IMHO contribute well to these kinds of discussions.
Post a new message to this list...

msuk (VIP)
All,

I have a C# library serviced component that I am trying to debug from a
ASP.Net page. The C# has the following attributes:

namespace yyyyyy
[assembly: ApplicationAccessControl(false)]
[assembly: Guid("860015D5-B182-4681-90D2-18C1CFFE8EE3")]
[assembly: ApplicationName("xxxxxx")]
[assembly: ApplicationID("88976ED4-61AF-4deb-9023-A81595B5780A")]
[assembly: ApplicationActivation(ActivationOption.Library)]

    [Guid("3BEE7B3D-EE64-435c-B482-5104D84936A7")]
    [EventTrackingEnabled(true)]
    [Transaction(TransactionOption.NotSupported)]
    [JustInTimeActivation(true)]
    [ObjectPooling(true)]
    public sealed class VirusMain : ServicedComponent

When the ASP.Net app tries to create an instance of the component I get the
following error:

Exception Details: System.UnauthorizedAccessException: Access to the
registry key HKEY_CLASSES_ROOT\xxxxxx\xxx 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.

Can anyone help?
Thanks

Reply to this message...
 
    
Nick Malik
The error message gives you excellent advice. Did you follow it? If you
want your ASP.NET app to call the registry, you have to provide an account
with priveleges to do that.

--- Nick

"msuk" <Click here to reveal e-mail address> wrote in message
news:Click here to reveal e-mail address...
[Original message clipped]

Reply to this message...
 
    
msuk (VIP)
Hi,

I did follow the message but I am not accessing the registry at all from my
ASP.Net app so that is what is confusing me.

Thanks
Msuk

"Nick Malik" wrote:

[Original message clipped]

Reply to this message...
 
    
Nicholas Paldino [.NET/C# MVP] (VIP)
Musk,

Yes, you are, in an indirect way. When you auto register your classes
that derive from ServicedComponent, it needs to place entries in the
registry.

--
- Nicholas Paldino [.NET/C# MVP]
- Click here to reveal e-mail address

"msuk" <Click here to reveal e-mail address> wrote in message
news:Click here to reveal e-mail address...
[Original message clipped]

Reply to this message...
 
    
msuk (VIP)
Ok,

What entres do I need to place and how?

Thanks
Msuk

"Nicholas Paldino [.NET/C# MVP]" wrote:

[Original message clipped]

Reply to this message...
 
    
Nicholas Paldino [.NET/C# MVP] (VIP)
Msuk,

You don't place the entries in the registry, .NET does it automatically
for you. That's why I recommended that you manually register the components
with COM+, instead of having .NET do it. You said it worked when you did
that (you couldn't debug, but the components worked).

--
- Nicholas Paldino [.NET/C# MVP]
- Click here to reveal e-mail address

"msuk" <Click here to reveal e-mail address> wrote in message
news:Click here to reveal e-mail address...
[Original message clipped]

Reply to this message...
 
    
Nicholas Paldino [.NET/C# MVP] (VIP)
Msuk,

Have you pre-registered your class with COM+ before you tried to access
the class? This might help, as I am thinking that the ASP.NET process is
trying to auto-register the component.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- Click here to reveal e-mail address

"msuk" <Click here to reveal e-mail address> wrote in message
news:Click here to reveal e-mail address...
[Original message clipped]

Reply to this message...
 
    
msuk (VIP)
hi,

If I pre-register the C# in COM+ my ASP.Net app calls this and does not step
into the code. I have tried to attach the process but it does not work?

Any ideas?
Msuk

"Nicholas Paldino [.NET/C# MVP]" wrote:

[Original message clipped]

Reply to this message...
 
    
Nicholas Paldino [.NET/C# MVP] (VIP)
Msuk,

Honestly, I would not try and debug from within a ServicedComponent. It
is a little buggy (the debug experience).

Rather, I would strip out the code for the object pooling, the
transactioning, etc, etc, and just debug the logic in a harness, and then
adding the aspects (transaction, object pooling, etc, etc).

--
- Nicholas Paldino [.NET/C# MVP]
- Click here to reveal e-mail address

"msuk" <Click here to reveal e-mail address> wrote in message
news:Click here to reveal e-mail address...
[Original message clipped]

Reply to this message...
 
 
System.EnterpriseServices.ActivationOption
System.EnterpriseServices.ServicedComponent
System.EnterpriseServices.TransactionOption
System.UnauthorizedAccessException




ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
Ad


Need Dot Net Interview Questions?
Ask ExamGuru, Inc. for advice and help on Passing .Net Interviews
.Net Projects
Best-of-breed application framework for .NET projects, developed by ExamGuru, Inc. and ExamGuru IT
Free .net Help
Commission ExamGuru, Inc. and his team for your next bespoke software project
FogBUGZ
The only bug tracking system carefully crafted with one goal in mind: helping teams create great software.
Awesome Tools
If you don't know about these, you're missing out... IT Certification Questions
IT Interview Questions
Free Oracle 10g Training
MCSE Boortcamp
Cisco Study Guides
Cheap Study Guides
Exact Questions
Dot Net Interview Questions
Oracle OCP
Cheap Travel
Designer Perfumes - Wholesale Prices
Free Programming Tutorials
 
ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
 Copyright © ExamGuru, Inc. 2001-2006
Contact Us - Terms of Use - Privacy Policy - www.dot-net-guru.com - www.examguru.net - www.oraclesource.net - www.itinterviews.net - www.examguru.net/ITCertification