locked
Compilation Errors after upgrading to .Net 4 RRS feed

  • Question

  • User1464353453 posted

    So after installing VS 2010 and .net 4 some time ago, I've been trying to upgrade web projects. Running in VS 2010 is not a problem, but when I publish to IIS 7, I keep getting compilation errors. To make things as simple as possible, I created a new Asp.Net  Web Application project. I didn't change anything, just left the default project. The project runs fine from VS 2010.

    Next, I publish the project to IIS using the File System publish method. This worked fine when my projects were .net 2, but using .net 4 projects, I always get errors like:

    Compilation Error

    Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

    Compiler Error Message: BC31007: Unable to open module file 'C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\web4\b2ae83a4\d2ec1e47\App_global.asax.r1psnh9h.0.vb': System Error &Hc0000005& (Visual Basic internal compiler error)

    Source Error:

    [No relevant source lines]

    Source File: C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\web4\b2ae83a4\d2ec1e47\App_global.asax.r1psnh9h.0.vb :    Line: 0


    Show Detailed Compiler Output:

    c:\windows\system32\inetsrv> "C:\Windows\Microsoft.NET\Framework\v4.0.30319\vbc.exe" /t:library /utf8output /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Core\v4.0_4.0.0.0__b77a5c561934e089\System.Core.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_32\System.Data\v4.0_4.0.0.0__b77a5c561934e089\System.Data.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Web.Extensions\v4.0_4.0.0.0__31bf3856ad364e35\System.Web.Extensions.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.CSharp\v4.0_4.0.0.0__b03f5f7f11d50a3a\Microsoft.CSharp.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.ServiceModel.Activation\v4.0_4.0.0.0__31bf3856ad364e35\System.ServiceModel.Activation.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Runtime.Serialization\v4.0_4.0.0.0__b77a5c561934e089\System.Runtime.Serialization.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Web.ApplicationServices\v4.0_4.0.0.0__31bf3856ad364e35\System.Web.ApplicationServices.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.ServiceModel.Web\v4.0_4.0.0.0__31bf3856ad364e35\System.ServiceModel.Web.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.ServiceModel\v4.0_4.0.0.0__b77a5c561934e089\System.ServiceModel.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Xml\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Web.Services\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Web.Services.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Activities\v4.0_4.0.0.0__31bf3856ad364e35\System.Activities.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Web.DynamicData\v4.0_4.0.0.0__31bf3856ad364e35\System.Web.DynamicData.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Configuration\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Xml.Linq\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.Linq.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.ServiceModel.Activities\v4.0_4.0.0.0__31bf3856ad364e35\System.ServiceModel.Activities.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Drawing\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Drawing.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_32\System.Web\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Web.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.IdentityModel\v4.0_4.0.0.0__b77a5c561934e089\System.IdentityModel.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_32\System.EnterpriseServices\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.EnterpriseServices.dll" /R:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\web4\b2ae83a4\d2ec1e47\assembly\dl3\131ffda9\96c51f36_5866cb01\Web4.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Data.DataSetExtensions\v4.0_4.0.0.0__b77a5c561934e089\System.Data.DataSetExtensions.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.ComponentModel.DataAnnotations\v4.0_4.0.0.0__31bf3856ad364e35\System.ComponentModel.DataAnnotations.dll" /R:"C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.WorkflowServices\v4.0_4.0.0.0__31bf3856ad364e35\System.WorkflowServices.dll" /out:"C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\web4\b2ae83a4\d2ec1e47\App_global.asax.r1psnh9h.dll" /D:DEBUG=1 /debug+ /nowarn:41008 /define:_MYTYPE=\"Web\" /imports:Microsoft.VisualBasic,System,System.Collections,System.Collections.Generic,System.Collections.Specialized,System.ComponentModel.DataAnnotations,System.Configuration,System.Linq,System.Text,System.Text.RegularExpressions,System.Web,System.Web.Caching,System.Web.DynamicData,System.Web.SessionState,System.Web.Security,System.Web.Profile,System.Web.UI,System.Web.UI.WebControls,System.Web.UI.WebControls.WebParts,System.Web.UI.HtmlControls,System.Xml.Linq /warnaserror- /optionInfer+  "C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\web4\b2ae83a4\d2ec1e47\App_global.asax.r1psnh9h.0.vb" "C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\web4\b2ae83a4\d2ec1e47\App_global.asax.r1psnh9h.1.vb"
    
    
    Microsoft (R) Visual Basic Compiler version 10.0.30319.1
    Copyright (c) Microsoft Corporation.  All rights reserved.
    
    C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\web4\b2ae83a4\d2ec1e47\App_global.asax.r1psnh9h.0.vb : error BC31007: Unable to open module file 'C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\web4\b2ae83a4\d2ec1e47\App_global.asax.r1psnh9h.0.vb': System Error &Hc0000005& (Visual Basic internal compiler error)
    C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\web4\b2ae83a4\d2ec1e47\App_global.asax.r1psnh9h.1.vb : error BC31007: Unable to open module file 'C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\web4\b2ae83a4\d2ec1e47\App_global.asax.r1psnh9h.1.vb': System Error &Hc0000005& (Visual Basic internal compiler error)
    
    

     

    I've made sure that ASP.NET v4.0 is set for the Application Pool. I've tried messing with rights. It feels like and installation/configuration issue in IIS, but I'm at a loss. I'm still running Vista on my laptop where the problem is. I tried the project on an XP box and don't get compilation issues (haven't tried my win 7 box yet).

    Thanks in advance for any advice

    Saturday, October 9, 2010 6:37 PM

Answers

  • User-944633366 posted

    Fix for me: Change the APP Pool (I'm running IIS7 for what it's worth) to be run by "Local System" instead of "Network Service".


    Also, the App Pool I'm using is one of the new pools created by .net 4.0 called .net 4.0 app pool or something like that.

    Also, I'm having the problem only on one of my dev machines, not all and not on the server. The dev machine is running Vista.


    As soon as I changed the owner of the App Pool, it worked. Don't know why. Got it from a post somewhere and it seems to work. Now I can just "save" an aspx file I'm working on and refresh my Chrome browser and it loads without needing to rebuild.


    I don't feel like it's "fixed" but I guess it is. Would like to know what's going on.


    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, November 14, 2010 12:09 PM

All replies

  • User1224940435 posted

    Hi,

    As it looks like it has problem with temporary  directory that used for compilation : v4.0.30319\Temporary ASP.NET Files\web4\b2ae83a4\d2ec1e47\App_global.asax.r1psnh9h.0.vb'

    SO go to directory v4.0.30319\Temporary ASP.NET Files\web4\b2ae83a4 then remove directory d2ec1e47.

    then try to compile and publish it again.

    Saturday, October 9, 2010 9:17 PM
  • User-1315512054 posted

    Hello,

    You should verify that the file is in the specified location (C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\web4\b2ae83a4\d2ec1e47\App_global.asax.r1psnh9h.0.vb), and is not locked by another application. 

    Regards

    Sunday, October 10, 2010 5:04 AM
  • User1464353453 posted

    Thank you,

    I have cleared out the Temporary ASP.NET Files directory and allowed ASP.net to rebuild the files, but still get the same errors.  I should also mention I tried re-registering asp.net using aspnet_regiis.exe.

    Any thoughts?

    Monday, October 11, 2010 11:17 PM
  • User-1219190079 posted

    I'm having the exact same issues with VS2010 and .Net 4.  When I compile and run the project in VS, it opens fine, however once I publish to IIS I'm getting the same BC31007 errors.  This happens no matter what project I'm using, even if I create a new default asp.net web application.

    Any resolutions for this?

    Wednesday, November 3, 2010 12:29 PM
  • User-1742404002 posted

    Same problem here. Just started today... something odd is going on with my server. Been looking all day to see if there was an exploit...


    Friday, November 12, 2010 8:04 PM
  • User-944633366 posted

    Me too. Same problem. I can see the page if I do a complete site rebuild, but if I just say change some text, then "save" the file and try to see it in chrome, I get this error.



    Saturday, November 13, 2010 10:20 AM
  • User-944633366 posted

    Fix for me: Change the APP Pool (I'm running IIS7 for what it's worth) to be run by "Local System" instead of "Network Service".


    Also, the App Pool I'm using is one of the new pools created by .net 4.0 called .net 4.0 app pool or something like that.

    Also, I'm having the problem only on one of my dev machines, not all and not on the server. The dev machine is running Vista.


    As soon as I changed the owner of the App Pool, it worked. Don't know why. Got it from a post somewhere and it seems to work. Now I can just "save" an aspx file I'm working on and refresh my Chrome browser and it loads without needing to rebuild.


    I don't feel like it's "fixed" but I guess it is. Would like to know what's going on.


    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Sunday, November 14, 2010 12:09 PM
  • User1464353453 posted

    Thank you! Changing the App Pool to Local System seems to have gotten me around the compilation issues. 

    Not sure what the deal was, but I was stuck for a long, long time on this one.

    Thanks again 

    Sunday, November 14, 2010 11:02 PM
  • User-1219190079 posted

    Thanks jbassett!!  Worked for me as well.  Was going to re-image this week if I still couldn't fix.  This is a life saver!

    Monday, November 15, 2010 9:44 AM
  • User-360635291 posted

    I hate to ask a newbie question but how do you change the App Pool to Local System and not Network Service?  I'm coming from IIS6 and never ran into this problem before.  I just created a simple ASPX page for IIS 7.5 and I got this exact error message.  Can someone give me specific steps?  I see Application Pools in IIS manager but I can not see how you can change the run by for the DefaultAppPool.

    Thanks in advance.

    Monday, November 29, 2010 9:51 PM
  • User-944633366 posted

    You aren't changing the app pool, you're changing who it runs under. Go to the app pools section, then advanced settings on the right of the screen, then process identity, then choose the "..." box and pick the right account for it to run under.


    ~Joe

    http://futz.me

    "A Command Line for the Web"


    Tuesday, November 30, 2010 12:50 PM
  • User-360635291 posted

    Perfect.  I got it changed and this fixed my problem also.

    Tuesday, November 30, 2010 1:07 PM
  • User-944633366 posted

    Hey, Can you mark this issue as "solved" so I can get credit for it? Thanks.


    Joe


    Monday, December 13, 2010 4:07 PM
  • User-809198070 posted

    Microsoft August 2013 updates 'broke' my IIS server.  The AppPools were running under something called ApplicationPoolIdentity.  Changed it to LocalSystem and all is fine.  Hope this stuff does not affect my site hoster. :-)

    Sunday, August 18, 2013 1:01 PM