Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
519 views
in Technique[技术] by (71.8m points)

asp.net - Compilation error CS0016: Could not write to output file

In Brief

When I attempt to browse my website, I get the following error message:

CS0016: Could not write to output file 'c:WindowsMicrosoft.NETFramework64v2.0.50727Temporary ASP.NET Fileswwwxxxyyyzzza.b.dll' - 'The directory name is invalid'

In Detail

I have two web-sites on my Development PC (fictitious names):

  • Web2 - this is written in ASP.NET using .NET 3.5 and runs in an AppPool that addresses the v2.0 .NET framework and runs in an Integrated mode. This is developed using Visual Studio 2010
  • Web4 - this is written in ASP.NET using .NET 4.5 and runs in an AppPool that addresses the v4.0 .NET framework and runs in an Integrated mode. This is developed using Visual Studio 2012.

Recently, I've been working in VS2012 on Web4 almost constantly and it works fine, however the other day I tried to run Web2 and got the exception displayed above.

Bizarrely, part of the path (which I replaced above with letters "zzz") appear to point to a German language path, since it's "de-DE" - I'm not operating in German, so I've no idea where it got this idea from.

One thing that is almost certainly un-related, but for some unknown reason I feel it's important to mention: I was using the Performance Analysis tool in Visual Studio 2012 the day before this problem first appeared and I don't know if this might have made some changes to my computer...??

Attempted fixes

There are quite a few threads regarding this on the internet; some threads end in success where file access permissions have been altered whilst others finish on a somewhat desperate sounding note... I have gone through the process of comparing the NTFS permissions on all relevant sounding directories on my PC with that of a colleagues on whose machine this is still working. Unfortunately, no joy to be had there.

I have also un-installed asp.net 2.0 and re-installed it using:

C:WindowsMicrosoft.NETFramework64v2.0.50727aspnet_regiis.exe -u
C:WindowsMicrosoft.NETFramework64v2.0.50727aspnet_regiis.exe -ir

and again, no joy to be had there either.

My Web4 continues to run unaffected.

Also FYI: using IIS 7.5 on Win7 x64.

I'm now turning to the this wider audience in the hope of turning my current state of despair into one of success.

Thanks everyone

Griff

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

In IIS Manager, in the advanced settings of the Application Pool, make sure "Process Model > Load User Profile" is set to "True".

I had this exact same problem. I tried changing permissions, disabling anti-virus, creating a new app pool, and reinstalling .NET. I even created a new site with just a "Default.aspx" page and tried to view that site. Even that site had the compilation error. Finally, I noticed that my app pools (clean test site and main site) had the non-default value "False" for the Load User Profile setting. I set that back to true and the issue went away.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...