HighTechTalks DotNet Forums  

Registry Permission For Web Service

Dotnet Security microsoft.public.dotnet.security


Discuss Registry Permission For Web Service in the Dotnet Security forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Michael Bird
 
Posts: n/a

Default Registry Permission For Web Service - 06-22-2004 , 09:47 AM






I haven't had to deal with the security stuff before now, and I can't seem
to get started. I have a web service, and I want to log to the event log.
When I try to create my event source I get a security exception that it
can't write to the registry. I have tried using the framework configuration
tool to mark the code as fully trusted (not a good thing, but I just wanted
to see if the code was working), but that didn't work.

Any idea on what I have to put into the code to make this happen?

Also, anyone know any good books or articles on using the security model?

Thanks



Reply With Quote
  #2  
Old   
Joe Kaplan \(MVP - ADSI\)
 
Posts: n/a

Default Re: Registry Permission For Web Service - 06-22-2004 , 10:59 AM






It is probably a Windows-based security error (UnauthorizedAccessException)
instead of a .NET Code Access Security problem (SecurityException).
Generally, the ASP.NET account does not have permission to create event
sources or check to see if they exist. It can only write to them.

Normally I solve this problem by creating the event log at install time
using Administrator privileges. You can also elevate the privileges of the
ASP.NET account, but that isn't a good idea, especially if this is the only
reason you need to do that.

Also, if you are on Win2K3, there are some issues with creating custom event
logs as well. If that applies to you, you might want to search this group
or MS support for more info.

Joe K.

"Michael Bird" <birdm @ symbol . com> wrote

Quote:
I haven't had to deal with the security stuff before now, and I can't seem
to get started. I have a web service, and I want to log to the event log.
When I try to create my event source I get a security exception that it
can't write to the registry. I have tried using the framework
configuration
tool to mark the code as fully trusted (not a good thing, but I just
wanted
to see if the code was working), but that didn't work.

Any idea on what I have to put into the code to make this happen?

Also, anyone know any good books or articles on using the security model?

Thanks





Reply With Quote
  #3  
Old   
Michael Bird
 
Posts: n/a

Default Re: Registry Permission For Web Service - 06-22-2004 , 11:39 AM



Actually, it is a SecurityException; and even if I put the IUSR and IWAM
accounts into the Administrators group just to check, I still get the
exception.


"Joe Kaplan (MVP - ADSI)" <joseph.e.kaplan (AT) removethis (DOT) accenture.com> wrote
in message news:#mfiUmGWEHA.2844 (AT) TK2MSFTNGP09 (DOT) phx.gbl...
Quote:
It is probably a Windows-based security error
(UnauthorizedAccessException)
instead of a .NET Code Access Security problem (SecurityException).
Generally, the ASP.NET account does not have permission to create event
sources or check to see if they exist. It can only write to them.

Normally I solve this problem by creating the event log at install time
using Administrator privileges. You can also elevate the privileges of
the
ASP.NET account, but that isn't a good idea, especially if this is the
only
reason you need to do that.

Also, if you are on Win2K3, there are some issues with creating custom
event
logs as well. If that applies to you, you might want to search this group
or MS support for more info.

Joe K.

"Michael Bird" <birdm @ symbol . com> wrote in message
news:emwlq9FWEHA.2340 (AT) TK2MSFTNGP09 (DOT) phx.gbl...
I haven't had to deal with the security stuff before now, and I can't
seem
to get started. I have a web service, and I want to log to the event
log.
When I try to create my event source I get a security exception that it
can't write to the registry. I have tried using the framework
configuration
tool to mark the code as fully trusted (not a good thing, but I just
wanted
to see if the code was working), but that didn't work.

Any idea on what I have to put into the code to make this happen?

Also, anyone know any good books or articles on using the security
model?

Thanks







Reply With Quote
  #4  
Old   
Joe Kaplan \(MVP - ADSI\)
 
Posts: n/a

Default Re: Registry Permission For Web Service - 06-22-2004 , 02:27 PM



Strike one for Kaplan! The error you are getting is not the more common
scenario then.

Is the web application configured to run in partial trust mode? Is there
anything in the securityPolicy element in web.config?

Typically, web applications run with Full Trust, so CAS doesn't enter into
the picture, but it sounds like that is not the case here.

The config element may be up the chain in one of the higher level web.config
files or in machine.config.

Joe K.


"Michael Bird" <birdm @ symbol . com> wrote

Quote:
Actually, it is a SecurityException; and even if I put the IUSR and IWAM
accounts into the Administrators group just to check, I still get the
exception.


"Joe Kaplan (MVP - ADSI)" <joseph.e.kaplan (AT) removethis (DOT) accenture.com> wrote
in message news:#mfiUmGWEHA.2844 (AT) TK2MSFTNGP09 (DOT) phx.gbl...
It is probably a Windows-based security error
(UnauthorizedAccessException)
instead of a .NET Code Access Security problem (SecurityException).
Generally, the ASP.NET account does not have permission to create event
sources or check to see if they exist. It can only write to them.

Normally I solve this problem by creating the event log at install time
using Administrator privileges. You can also elevate the privileges of
the
ASP.NET account, but that isn't a good idea, especially if this is the
only
reason you need to do that.

Also, if you are on Win2K3, there are some issues with creating custom
event
logs as well. If that applies to you, you might want to search this
group
or MS support for more info.

Joe K.

"Michael Bird" <birdm @ symbol . com> wrote in message
news:emwlq9FWEHA.2340 (AT) TK2MSFTNGP09 (DOT) phx.gbl...
I haven't had to deal with the security stuff before now, and I can't
seem
to get started. I have a web service, and I want to log to the event
log.
When I try to create my event source I get a security exception that
it
can't write to the registry. I have tried using the framework
configuration
tool to mark the code as fully trusted (not a good thing, but I just
wanted
to see if the code was working), but that didn't work.

Any idea on what I have to put into the code to make this happen?

Also, anyone know any good books or articles on using the security
model?

Thanks









Reply With Quote
  #5  
Old   
Michael Bird
 
Posts: n/a

Default Re: Registry Permission For Web Service - 06-23-2004 , 04:42 PM



Your first suggestion of fixing the problem by creating the event log source
ahead of time did the trick. Thanks for that one. Now I still need to
better understand how code-access security works and where the limit to not
allow the code to write to the registry was coming from since it wasn't the
trust on the code or the user account priveleges...


"Joe Kaplan (MVP - ADSI)" <joseph.e.kaplan (AT) removethis (DOT) accenture.com> wrote
in message news:#l1$HaIWEHA.3740 (AT) TK2MSFTNGP12 (DOT) phx.gbl...
Quote:
Strike one for Kaplan! The error you are getting is not the more common
scenario then.

Is the web application configured to run in partial trust mode? Is there
anything in the securityPolicy element in web.config?

Typically, web applications run with Full Trust, so CAS doesn't enter into
the picture, but it sounds like that is not the case here.

The config element may be up the chain in one of the higher level
web.config
files or in machine.config.

Joe K.


"Michael Bird" <birdm @ symbol . com> wrote in message
news:uuj6p8GWEHA.4064 (AT) TK2MSFTNGP11 (DOT) phx.gbl...
Actually, it is a SecurityException; and even if I put the IUSR and IWAM
accounts into the Administrators group just to check, I still get the
exception.


"Joe Kaplan (MVP - ADSI)" <joseph.e.kaplan (AT) removethis (DOT) accenture.com
wrote
in message news:#mfiUmGWEHA.2844 (AT) TK2MSFTNGP09 (DOT) phx.gbl...
It is probably a Windows-based security error
(UnauthorizedAccessException)
instead of a .NET Code Access Security problem (SecurityException).
Generally, the ASP.NET account does not have permission to create
event
sources or check to see if they exist. It can only write to them.

Normally I solve this problem by creating the event log at install
time
using Administrator privileges. You can also elevate the privileges
of
the
ASP.NET account, but that isn't a good idea, especially if this is the
only
reason you need to do that.

Also, if you are on Win2K3, there are some issues with creating custom
event
logs as well. If that applies to you, you might want to search this
group
or MS support for more info.

Joe K.

"Michael Bird" <birdm @ symbol . com> wrote in message
news:emwlq9FWEHA.2340 (AT) TK2MSFTNGP09 (DOT) phx.gbl...
I haven't had to deal with the security stuff before now, and I
can't
seem
to get started. I have a web service, and I want to log to the
event
log.
When I try to create my event source I get a security exception that
it
can't write to the registry. I have tried using the framework
configuration
tool to mark the code as fully trusted (not a good thing, but I just
wanted
to see if the code was working), but that didn't work.

Any idea on what I have to put into the code to make this happen?

Also, anyone know any good books or articles on using the security
model?

Thanks











Reply With Quote
  #6  
Old   
Joe Kaplan \(MVP - ADSI\)
 
Posts: n/a

Default Re: Registry Permission For Web Service - 06-23-2004 , 06:23 PM



Glad that worked. I'm still confused about what the actual problem was too.
You said it was a SecurityException which leads me to believe it was a CAS
problem (partial trust), but that isn't clear it was the case. Maybe
someone else will chime in.

Joe K.

"Michael Bird" <birdm @ symbol . com> wrote

Quote:
Your first suggestion of fixing the problem by creating the event log
source
ahead of time did the trick. Thanks for that one. Now I still need to
better understand how code-access security works and where the limit to
not
allow the code to write to the registry was coming from since it wasn't
the
trust on the code or the user account priveleges...


"Joe Kaplan (MVP - ADSI)" <joseph.e.kaplan (AT) removethis (DOT) accenture.com> wrote
in message news:#l1$HaIWEHA.3740 (AT) TK2MSFTNGP12 (DOT) phx.gbl...
Strike one for Kaplan! The error you are getting is not the more
common
scenario then.

Is the web application configured to run in partial trust mode? Is
there
anything in the securityPolicy element in web.config?

Typically, web applications run with Full Trust, so CAS doesn't enter
into
the picture, but it sounds like that is not the case here.

The config element may be up the chain in one of the higher level
web.config
files or in machine.config.

Joe K.


"Michael Bird" <birdm @ symbol . com> wrote in message
news:uuj6p8GWEHA.4064 (AT) TK2MSFTNGP11 (DOT) phx.gbl...
Actually, it is a SecurityException; and even if I put the IUSR and
IWAM
accounts into the Administrators group just to check, I still get the
exception.


"Joe Kaplan (MVP - ADSI)" <joseph.e.kaplan (AT) removethis (DOT) accenture.com
wrote
in message news:#mfiUmGWEHA.2844 (AT) TK2MSFTNGP09 (DOT) phx.gbl...
It is probably a Windows-based security error
(UnauthorizedAccessException)
instead of a .NET Code Access Security problem (SecurityException).
Generally, the ASP.NET account does not have permission to create
event
sources or check to see if they exist. It can only write to them.

Normally I solve this problem by creating the event log at install
time
using Administrator privileges. You can also elevate the privileges
of
the
ASP.NET account, but that isn't a good idea, especially if this is
the
only
reason you need to do that.

Also, if you are on Win2K3, there are some issues with creating
custom
event
logs as well. If that applies to you, you might want to search this
group
or MS support for more info.

Joe K.

"Michael Bird" <birdm @ symbol . com> wrote in message
news:emwlq9FWEHA.2340 (AT) TK2MSFTNGP09 (DOT) phx.gbl...
I haven't had to deal with the security stuff before now, and I
can't
seem
to get started. I have a web service, and I want to log to the
event
log.
When I try to create my event source I get a security exception
that
it
can't write to the registry. I have tried using the framework
configuration
tool to mark the code as fully trusted (not a good thing, but I
just
wanted
to see if the code was working), but that didn't work.

Any idea on what I have to put into the code to make this happen?

Also, anyone know any good books or articles on using the security
model?

Thanks













Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.