Prevent .NET from writing in C: \ Windows \ Temp

I have a C # application that I am trying to push into a distributed network. The application works fine locally (as always), but when I push it to the network, it does not work, because it cannot be written to the C: \ Windows \ Temp directory. I actually do not find the code that writes to this directory, but I assume that this is caused by my web service calls, given the following exception:

Unable to create a temporary class (result = 1). Error CS2001: Source file 'C: \ WINDOWS \ TEMP \ cyalinh1.0.cs' could not detect error CS2008: no inputs specified. See InnerException for more details.

Is there a way to prevent .NET from writing to the Temp directory? Is this a parameter in the .config file?

UPDATE

Can SGEN be used to prevent the creation of these dynamically created classes from a web service?

+5
source share
5 answers

It seems like web services require read and write permission% SystemRoot% \ Temp ( MSDN ).

From here :

If you are using ASP.NET 2.0 or higher, you can assign the required permissions using the command:

aspnet_regiis -GA MachineName\Account 

This blog post contains instructions on how to change the location of the SystemRoot \ Temp folder used for this (as well as instructions on how to use the reflector to determine the setting in web.config to establish this situation)

+4
source

The problem is that you are using some function that automatically generates a temporary code. It requires a place for it. So yes, although you can prevent him from writing code in this particular place, the only way to prevent him from creating code (which must be stored somewhere) is to not use a function that generates temporary classes.

+1
source

the process executing this code (NT account for IIS?) must have an appropriate set of permissions read more http://www.google.com/search?q=asp.net+writing+files+permissions

0
source

Josh

I assume that the call you are making is trying to start a debugging session on the target PC. It tries to pull the source file after an exception.

The root cause is probably the exception to the web service call.

To reduce writing to the temp folder, you can disable timely debugging on target computers: something like <system.windows.forms jitDebugging="false"/> in the application configuration

I did digging. It seems that the problem may be on the server, and not on the client machines. If you added read / write permissions to the temp folder for the user hosting the web service, this might be OK. Sorry for the crazy advice above ...

0
source

Searched so many forums and finally fixed it. It helped me ... come here!

  • right click on c: \ windows \ temp folder

  • under the security tab, add the iisuser account to the list of users and give read / write / execute permissions (or) full rights

  • restart website

Thats it !!! ... check out an application that uses a deployed web service

It has to be done.

0
source

All Articles