UnauthorizedAccessException upon access to an ASP>NET web service

B

Bruce

I am developing an ASP.NET web service application. It works fine on my
WinXP Prof development machine. But when I send it to a Windows Server 2003
system I get the following error (attached below).

I suppose I have some kind of permissions issue on the server? What
recommendations can anyone propose?

Thanks,
-- Bruce

Server Error in '/firstWebSvs' Application.
--------------------------------------------------------------------------------

Access to the path "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Temporary
ASP.NET Files\firstwebsvs\41aa9288\50d8dfa7" 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 path
"C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET
Files\firstwebsvs\41aa9288\50d8dfa7" 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:

An unhandled exception was generated during the execution of the current web
request. Information regarding the origin and location of the exception can
be identified using the exception stack trace below.

Stack Trace:

[UnauthorizedAccessException: Access to the path
"C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET
Files\firstwebsvs\41aa9288\50d8dfa7" is denied.]
System.IO.__Error.WinIOError(Int32 errorCode, String str) +393
System.IO.Directory.InternalCreateDirectory(String fullPath, String path)
+632
System.IO.Directory.CreateDirectory(String path) +195
System.Web.Compilation.PreservedAssemblyEntry.DoFirstTimeInit(HttpContext
context) +85
System.Web.Compilation.PreservedAssemblyEntry.EnsureFirstTimeInit(HttpContext
context) +97
System.Web.Compilation.PreservedAssemblyEntry.GetPreservedAssemblyEntry(HttpContext
context, String virtualPath, Boolean fApplicationFile) +29
System.Web.UI.TemplateParser.GetParserCacheItemFromPreservedCompilation()
+91
System.Web.UI.TemplateParser.GetParserCacheItemInternal(Boolean
fCreateIfNotFound) +148
System.Web.UI.TemplateParser.GetParserCacheItemWithNewConfigPath() +125
System.Web.UI.TemplateParser.GetParserCacheItem() +88
System.Web.UI.ApplicationFileParser.GetCompiledApplicationType(String
inputFile, HttpContext context, ApplicationFileParser& parser) +168
System.Web.HttpApplicationFactory.CompileApplication(HttpContext context)
+43
System.Web.HttpApplicationFactory.Init(HttpContext context) +485
System.Web.HttpApplicationFactory.GetApplicationInstance(HttpContext
context) +170
System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +414
 
R

Rick Strahl [MVP]

Hi Bruce,

Make sure you give that temp directory (Temporary ASP.NET Files) full access
for the Network Service or whatever account your Application Pool in IIS 6
runs under. Actually I think ASP.NET install sets up the NETWORK SERVICE
account automatically but not any others you might get assigned with an ISP
Web Site and custom Application Pool for your site.

Hope this helps,

+++ Rick ---


Bruce said:
I am developing an ASP.NET web service application. It works fine on my
WinXP Prof development machine. But when I send it to a Windows Server 2003
system I get the following error (attached below).

I suppose I have some kind of permissions issue on the server? What
recommendations can anyone propose?

Thanks,
-- Bruce

Server Error in '/firstWebSvs' Application.
-------------------------------------------------------------------------- ------

Access to the path "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Temporary
ASP.NET Files\firstwebsvs\41aa9288\50d8dfa7" 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 path
"C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET
Files\firstwebsvs\41aa9288\50d8dfa7" 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:

An unhandled exception was generated during the execution of the current web
request. Information regarding the origin and location of the exception can
be identified using the exception stack trace below.

Stack Trace:

[UnauthorizedAccessException: Access to the path
"C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET
Files\firstwebsvs\41aa9288\50d8dfa7" is denied.]
System.IO.__Error.WinIOError(Int32 errorCode, String str) +393
System.IO.Directory.InternalCreateDirectory(String fullPath, String path)
+632
System.IO.Directory.CreateDirectory(String path) +195
System.Web.Compilation.PreservedAssemblyEntry.DoFirstTimeInit(HttpContext
context) +85
System.Web.Compilation.PreservedAssemblyEntry.EnsureFirstTimeInit(HttpContex
t
context) +97
System.Web.Compilation.PreservedAssemblyEntry.GetPreservedAssemblyEntry(Http
Context
context, String virtualPath, Boolean fApplicationFile) +29
System.Web.UI.TemplateParser.GetParserCacheItemFromPreservedCompilation()
+91
System.Web.UI.TemplateParser.GetParserCacheItemInternal(Boolean
fCreateIfNotFound) +148
System.Web.UI.TemplateParser.GetParserCacheItemWithNewConfigPath() +125
System.Web.UI.TemplateParser.GetParserCacheItem() +88
System.Web.UI.ApplicationFileParser.GetCompiledApplicationType(String
inputFile, HttpContext context, ApplicationFileParser& parser) +168
System.Web.HttpApplicationFactory.CompileApplication(HttpContext context)
+43
System.Web.HttpApplicationFactory.Init(HttpContext context) +485
System.Web.HttpApplicationFactory.GetApplicationInstance(HttpContext
context) +170
System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +414
--------------------------------------------------------------------------
 
B

Bruce

Rick,

Thanks.

Actually, this is not an ISP server, but rather a Windows Small Business
Server 2003 server here in my home office. Everything about the setup of
this server is pretty much default configuration. (ASP.NET 1.1, of course,
is simply installed on the server "out of the box.")

Would I normally need to do something special to enable a web service to run
on the server?

To install from the development workstation to the server, I simply used the
vs.net 2003 menu item, "copy project", to move a copy onto the server. As a
result, a new directory was created on the server within inetpub/wwwroot
called /firstWebSvs, which is the same name the directory had on my
development workstation.

Finally, could you explain what you mean by temp directory? ( So far, I
don't seem to use any directory that would be called a temp directory.)

Thanks,
-- Bruce

Rick Strahl said:
Hi Bruce,

Make sure you give that temp directory (Temporary ASP.NET Files) full
access
for the Network Service or whatever account your Application Pool in IIS 6
runs under. Actually I think ASP.NET install sets up the NETWORK SERVICE
account automatically but not any others you might get assigned with an
ISP
Web Site and custom Application Pool for your site.

Hope this helps,

+++ Rick ---


Bruce said:
I am developing an ASP.NET web service application. It works fine on my
WinXP Prof development machine. But when I send it to a Windows Server 2003
system I get the following error (attached below).

I suppose I have some kind of permissions issue on the server? What
recommendations can anyone propose?

Thanks,
-- Bruce

Server Error in '/firstWebSvs' Application.
-------------------------------------------------------------------------- ------

Access to the path
"C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Temporary
ASP.NET Files\firstwebsvs\41aa9288\50d8dfa7" 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 path
"C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET
Files\firstwebsvs\41aa9288\50d8dfa7" 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:

An unhandled exception was generated during the execution of the current web
request. Information regarding the origin and location of the exception can
be identified using the exception stack trace below.

Stack Trace:

[UnauthorizedAccessException: Access to the path
"C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET
Files\firstwebsvs\41aa9288\50d8dfa7" is denied.]
System.IO.__Error.WinIOError(Int32 errorCode, String str) +393
System.IO.Directory.InternalCreateDirectory(String fullPath, String path)
+632
System.IO.Directory.CreateDirectory(String path) +195
System.Web.Compilation.PreservedAssemblyEntry.DoFirstTimeInit(HttpContext
context) +85
System.Web.Compilation.PreservedAssemblyEntry.EnsureFirstTimeInit(HttpContex
t
context) +97
System.Web.Compilation.PreservedAssemblyEntry.GetPreservedAssemblyEntry(Http
Context
context, String virtualPath, Boolean fApplicationFile) +29
System.Web.UI.TemplateParser.GetParserCacheItemFromPreservedCompilation()
+91
System.Web.UI.TemplateParser.GetParserCacheItemInternal(Boolean
fCreateIfNotFound) +148
System.Web.UI.TemplateParser.GetParserCacheItemWithNewConfigPath()
+125
System.Web.UI.TemplateParser.GetParserCacheItem() +88
System.Web.UI.ApplicationFileParser.GetCompiledApplicationType(String
inputFile, HttpContext context, ApplicationFileParser& parser) +168
System.Web.HttpApplicationFactory.CompileApplication(HttpContext context)
+43
System.Web.HttpApplicationFactory.Init(HttpContext context) +485
System.Web.HttpApplicationFactory.GetApplicationInstance(HttpContext
context) +170
System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +414
--------------------------------------------------------------------------
 
B

Bruce

I was able to get the web service to work on the server via an article I
found by searching another newsgroup. I needed to give the Local Service
and Network Service accounts Full Control permission to the
%windir%\Microsoft.NET\Framework\v1.1.4322 directories. Is there any
downside (from a security standpoint) to granting these permissions?

Thanks,
Bruce

Bruce said:
Rick,

Thanks.

Actually, this is not an ISP server, but rather a Windows Small Business
Server 2003 server here in my home office. Everything about the setup of
this server is pretty much default configuration. (ASP.NET 1.1, of
course, is simply installed on the server "out of the box.")

Would I normally need to do something special to enable a web service to
run on the server?

To install from the development workstation to the server, I simply used
the vs.net 2003 menu item, "copy project", to move a copy onto the server.
As a result, a new directory was created on the server within
inetpub/wwwroot called /firstWebSvs, which is the same name the directory
had on my development workstation.

Finally, could you explain what you mean by temp directory? ( So far, I
don't seem to use any directory that would be called a temp directory.)

Thanks,
-- Bruce

Rick Strahl said:
Hi Bruce,

Make sure you give that temp directory (Temporary ASP.NET Files) full
access
for the Network Service or whatever account your Application Pool in IIS
6
runs under. Actually I think ASP.NET install sets up the NETWORK SERVICE
account automatically but not any others you might get assigned with an
ISP
Web Site and custom Application Pool for your site.

Hope this helps,

+++ Rick ---


Bruce said:
I am developing an ASP.NET web service application. It works fine on my
WinXP Prof development machine. But when I send it to a Windows Server 2003
system I get the following error (attached below).

I suppose I have some kind of permissions issue on the server? What
recommendations can anyone propose?

Thanks,
-- Bruce

Server Error in '/firstWebSvs' Application.
-------------------------------------------------------------------------- ------

Access to the path
"C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Temporary
ASP.NET Files\firstwebsvs\41aa9288\50d8dfa7" 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
path
"C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET
Files\firstwebsvs\41aa9288\50d8dfa7" 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:

An unhandled exception was generated during the execution of the current web
request. Information regarding the origin and location of the exception can
be identified using the exception stack trace below.

Stack Trace:

[UnauthorizedAccessException: Access to the path
"C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET
Files\firstwebsvs\41aa9288\50d8dfa7" is denied.]
System.IO.__Error.WinIOError(Int32 errorCode, String str) +393
System.IO.Directory.InternalCreateDirectory(String fullPath, String path)
+632
System.IO.Directory.CreateDirectory(String path) +195
System.Web.Compilation.PreservedAssemblyEntry.DoFirstTimeInit(HttpContext
context) +85
System.Web.Compilation.PreservedAssemblyEntry.EnsureFirstTimeInit(HttpContex
t
context) +97
System.Web.Compilation.PreservedAssemblyEntry.GetPreservedAssemblyEntry(Http
Context
context, String virtualPath, Boolean fApplicationFile) +29
System.Web.UI.TemplateParser.GetParserCacheItemFromPreservedCompilation()
+91
System.Web.UI.TemplateParser.GetParserCacheItemInternal(Boolean
fCreateIfNotFound) +148
System.Web.UI.TemplateParser.GetParserCacheItemWithNewConfigPath()
+125
System.Web.UI.TemplateParser.GetParserCacheItem() +88
System.Web.UI.ApplicationFileParser.GetCompiledApplicationType(String
inputFile, HttpContext context, ApplicationFileParser& parser) +168
System.Web.HttpApplicationFactory.CompileApplication(HttpContext context)
+43
System.Web.HttpApplicationFactory.Init(HttpContext context) +485
System.Web.HttpApplicationFactory.GetApplicationInstance(HttpContext
context) +170
System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +414
--------------------------------------------------------------------------
 

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,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top