45

I have a VS 2005 web site that I publish using "Publish Web Site", and I clear all the three checkboxes. I also have a deployment project that picks up the published files and creates an MSI. I then install the package on a separate test server.

In other words, the whole site is pre-compiled. However, when I go to any .aspx file in a specific subfolder named "Services", I get an HttpException:

System.Web.HttpException: The file '/myapp/Services/mypage.aspx' has not been pre-compiled, and cannot be requested.

If I go to an .aspx file in an other folder, be it the root or other subfolder, it works properly.

The contents of mypage.aspx itself is: <%@ Page Language="C#" AutoEventWireup="true" CodeFile="mypage.aspx.cs" Inherits="Services_mypage" %>"

In the /myapp/bin folder I can see a mypage.aspx.989dc2fb.compiled file. The content of this seems to point to a certain assembly that is also present in the bin folder.

Why is this error occurring? The .compiled file is there, and the assembly is there, and the type in question is present in that assembly (I can see it in Object Browser). Is it something about the name or the content of the .compiled file? Do I have the wrong version somehow? What does the seemingly random number in the .compiled filename mean and is it important?

I also want to mention that this issue appeared suddenly, and I'm not sure what changes there can have been done since it worked properly a few days ago (but to the best of my knowledge, none).

p.campbell
  • 98,673
  • 67
  • 256
  • 322
jonsb
  • 2,016
  • 3
  • 21
  • 24
  • In case it was working before, and suddenly you get this error message, try setting the 'Enable 32-Bit Applications' to True in the advanced options of the ApplicationPool. – Vincent May 22 '20 at 20:46

27 Answers27

26

I've not had that error, but after a little Googling I came across this link, I'm not sure if you've seen it yet: http://forums.asp.net/t/956297.aspx

Edit (adding the key text):

This error will come when a reference is specified in web.config and deployment folder/site does not contain these dlls installed in the system or bin folder does not contain them(if they are private assemblies). For Example: (add assembly="Namespace1.NameSpace2, Version=x.x.x.x, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/) if your web.config contains any assemblies like this and deployed server doesnot contain these assembiles in bin or GAC, then this error will occur.

People were reporting that missing assemblies on the destination server ended up being the root cause, in their cases, but they had the same error as you. Weird.

Maybe that's the problem?

Mark A
  • 5,881
  • 5
  • 26
  • 34
Carl
  • 1,706
  • 1
  • 17
  • 25
  • 1
    +1 for the hint from me too. Turns out we had a missing control assembly. – Dave Becker Jun 19 '12 at 09:50
  • 2
    Slightly different twist for me, but same dll theme. I had Project A that produced a dll with some precompiled user controls that were used in Project B. Both projects made use of Telerik RadControls but different versions. The pages in Project B that didn't use the controls from A worked, the ones that did gave an appropriate message about the version mismatch. And then the .asmx services in B gave the very unhelpful not pre-compiled message. Syncing up the versions fixed it all. – Piwaf Dec 21 '12 at 18:22
  • The site was working partially for me. Verified all file counts were identical from my previous build. Deleting the PrecompiledApp.config infact made all aspx show the message that it is marker text for compiled pages. Complete recompile of the project did the trick for me. All works good now. – user836107 Dec 28 '15 at 17:02
  • In my case i am missing Microsoft.ReportViewer.Common,Microsoft.ReportViewer.ProcessingObjectModel ,Microsoft.ReportViewer.WebForms, Microsoft.ReportViewer.WinForms,Microsoft.SqlServer.Types Assemblies – Dgan Oct 31 '17 at 12:32
23

I got this error when I upgraded a site from 2.0 to 4.0. The error was caused by a file PrecompiledApp.config in the site's root directory. Once I deleted that file, the site started working.

Anne
  • 26,765
  • 9
  • 65
  • 71
Gath Adams
  • 231
  • 2
  • 2
18

Just as a footnote to all of the above answers that resolved the issue via republishing to replace a missing assembly... While i have solved this issue previously with that same solution, i have just encountered another reason for it's occurrence which may assist others.

The AppPool that my site was running under had it's "Enable 32-bit applications" setting set to false. By changing this to true via the "Advanced Settings" dialog of the app pool i resolved my issue.

Hope that helps some other poor sucker.

krisg
  • 796
  • 1
  • 9
  • 24
15

I ran into the same issue. My problem was fixed by deleting the files in the temporary asp.net files folder in this folder:

C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root 
  • 1
    We also had the same error and this solution fixed it for us. We had 24 web servers, all running the same codebase and some were displaying this error while others were not. We purged this folder on all web servers and the problem went away. – Timothy Beamish Nov 17 '19 at 16:57
  • This was almost the perfect solution - but for us, removing just the "root" folder wasn't enough. We needed to delete *all* of the temp folders under "Temporary ASP.NET Files", to get rid of this exception. There seemed to be one folder per IIS website, so I assume the faulty/corrupted file was in there, rather than in the "root" folder. – Mike Gledhill Jun 08 '22 at 14:37
9

I have been struggling to fix this issue for past few days. At least in my case, the error message was completely misleading and had nothing to do with precompiled website. There are many articles or posts out there that give many different answers which only add to confusion. I personally believe this error is caused mainly due to missing references or incorrect versioning. In order to fix the issue as fast as possible you have to rule this out, or otherwise fix the missing/wrong reference.

To do so you need to use a tool named "Assembly Binding Log Viewer". This tool will tell you which references are missing or have wrong versions. If there is a missing/mismatched reference then go ahead and fix it; otherwise you need to do the other magic tricks like checking for App Pool being 32-bit or permissions.

Steps:

  1. At your server create the following folders

    C:\fuslog C:\fuslog\logs

  2. Copy Assembly Binding Log Viewer to your server at C:\fuslog:

    You can find the program at a location like this

    C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\fuslogvw.exe

    You might need to look at "Program Files" instead of "Program Files (x86)" or look into different vesions instead of "v7.0A"

  3. Execute fuslogvw.exe at server

  4. Click on "Setting..."

  5. Ensure "Log bind failures to disk" is checked

  6. Check the Enable custom log path and enter the following in the box: C:\fuslog\logs

  7. Click on OK

  8. Recycle/reset your app pool to enforce a fresh binding

  9. Click on Refresh. Now you can see the failed binding in here

  10. The better way to find the exact binding is to go to c:\fuslog\logs\Default. In here you can find the exact binding failures. Some are irrelevant and you need to find the critical one by trial and error. Mine was the following failure:

     System.Web.Mvc, Version=4.0.0.1, Culture=neutral, PublicKeyToken=31bf3856ad364e35
    

I fixed the issue by adding the following entry at my web sites web.config:

<configuration>
    ...
    <runtime>
        ...
        <!-- Added this entry to fix the issue -->
        <dependentAssembly>
            <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
            <bindingRedirect oldVersion="0.0.0.0-4.0.0.1" newVersion="4.0.0.0" />
        </dependentAssembly>
        ...
    </runtime>
    ...
</configuration>

I hope this helps others to quickly fix the issue.

Aidin
  • 2,134
  • 22
  • 26
  • 2
    Thank you buddy. You deserve all my votes for this well described solution. I think all the answers above should be replaced by yours. Kudos. Worth mentioning the following article. http://www.hanselman.com/blog/BackToBasicsUsingFusionLogViewerToDebugObscureLoaderErrors.aspx – ken Jan 15 '15 at 17:46
  • This was the only way I was able to find the missing dll among the many in our enterprise project, IIS wasn't able to provide any other clue. – f.cipriani May 10 '16 at 13:51
  • Assembly Binding works well to figure out which assembly is failing! A shorter way of enabling it is to set EnableLog to 1 in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Fusion. https://port135.com/2018/05/17/how-to-enable-assembly-binding-logging-debugging-net-applications/ – Ned Jul 30 '19 at 15:26
  • Your comment saved me and my coworker after hours of trying to get a website updated. Blessings on you and yours. – bweaver2 May 15 '21 at 01:06
6

This error has occurred to me, and I solved it.

When you want to publish your site, check use fixed naming and single page assemblies in Visual Studio

You'll see this problem will be solved!

Danny Beckett
  • 20,529
  • 24
  • 107
  • 134
aws
  • 61
  • 1
  • 1
3

We fixed this by restarting the AppPool, after trying several of the other solutions. Republishing was not an option on this occasion.

Justin
  • 501
  • 5
  • 13
3

It turned out to be a missing (non-web) DLL in the MSI, which I assume was used by the pages giving the error. A quite misleading error message I'd say, as the page was certainly precompiled, but had a missing reference to that DLL.

jonsb
  • 2,016
  • 3
  • 21
  • 24
2

I had the same problem today. Some forums tell about there is are missing reference in your website and it certainly does in your case. Despite you have all the necessary assemblies included, you might been deploying your website in a IIS server with 3.5 framework, right?

Well it was my case, so I copied the web.config file from an original ASPX 3.5 website and modified some parts (removed other 3.5 assembly references) and try deploy it again.

HasanG
  • 12,734
  • 29
  • 100
  • 154
2

This option solved the problem for me. Basically, it removes every orphan file left after previous deploy.

Remove additional files at destination

Ivan Nikitin
  • 3,578
  • 27
  • 39
2

For me, I had a script that deletes the production folder and then copies up the new files.

The script failed to delete the production folder properly leaving that the old and new files were mixed in together causing the error.

I manually deleted the entire folder and redeployed successfully...then updated the script.

Adam
  • 403
  • 3
  • 8
2

This problem can be caused by many different reasons. Mine was sporadic on pages that woked for a while and suddenly gave the error mentioned. It was a memory pressure related problem
this thread had the correct answer for me and i've also posted my workaround there.

1

Start by checking available disc space. I got this error when we ran out of space on the hard drive hosting IIS.

1

This error can also occur if you have a .compiled file in bin for a page that is no longer a part of your project. You receive this in place of 404 essentially. Remove the .compiled file and then you get 404.

Licht
  • 1,079
  • 1
  • 12
  • 27
1

Redeployment of the same files also fixed this issue in my case.

So maybe before trying anything else first try to deploy you app again (bin folder content should be enough)

BTW: In my case the error started when C drive run out of space.

Happy coding! ChiTec

ChiTec
  • 163
  • 1
  • 1
  • 8
1

Under the website root folder, there is one file named PrecompiledApp.config, after updating the updatable="true", the site is working again.

Tony Dong
  • 3,213
  • 1
  • 29
  • 32
1

I know the error is complaining about something else but I promise in my case the problem was just the insufficient Access permission(Network Service or Application Pool identity or IUSR) for asp.net account to work with that specific file.

it was due to unusual deploying and mixing bin files with new published ones in our VPS environment.

solution:

that specific file permissions need to be replaced with correct Bin folder permissions like other files that are working correctly(and wo that error) inside Bin.

enter image description here

Iman
  • 17,932
  • 6
  • 80
  • 90
0

In my case I was not uploading the common DLLs like AjaxControlToolkit.dll, Telerik.dll etc. I uploaded the whole published folder and it fixed it for me.

Yasir Ali
  • 21
  • 2
0

In case of a update and then recompile. copy all the files from bin folder again and also the particular file updated from its respective folder.

0

In my case of an error for an asp.net mvc razor view (.cshtml), /bin folder contained two .compiled files for the same view. One of them was old and needed to be deleted.

I also had a second view in the controller views subfolder which also needed to be deleted.

The reason for a problem is that I moved a view from controller views subfolder into the Shared folder, however my deployment process (Visual Studio Publish) did not delete the obsolete view and view.compiled files from the server. You can instruct Visual Studio to always clean up the destination folder, but this would make the deployment process slower.

Klotin
  • 165
  • 1
  • 12
0

Finally, I found the problem. If you use MVC framework like me, please update your MVC version.In my case I changed MVC 4.0.0.0 to 4.0.0.1 and checked all project references's "Local Copy" properties to "True". After that my problem solved. Please check out MVC version in all config file(4.0.0.0->4.0.0.1)

And watch out asp compiler warning messages.

0

I had the same problem when I started using VWD Express 2012 (after I was using Express 2010, which used to work okay) Went to my hosting control panels and changed ASP.NET version from 2.0-Classic to 4.0 Classic as shown. Problem gone.

Juliano Alves
  • 2,006
  • 4
  • 35
  • 37
Khalid Gomaa
  • 1
  • 1
  • 2
0

i was facing this problem when i deployed some changes to my existing site.

To recover from the issue i deleted all files from bin folder and redeployed them.

The issue then resolved.

I hope this may be help some one.

VMAtm
  • 27,943
  • 17
  • 79
  • 125
0

In my case 'nnn.aspx.xxxxxxxx.compiled' file was removed by WebDeploy, because I ran 2 simultaneous jobs in the same Jenkins workspace. The second job removed some files during WebDeploy package creation.

Der_Meister
  • 4,771
  • 2
  • 46
  • 53
0

This is the solution for VS 2008.

Please tick the box as shown below to resolve the issue.

enter image description here

RobC
  • 22,977
  • 20
  • 73
  • 80
Anson Davis
  • 37
  • 10
0

If you get this error when running an MSBuild script, chances are that your project is a 2.0 or 3.5 project and MSBuild is using the 4.0 compiler. Try adding:

TargetFrameworkMoniker="3.5"

to your AspNetCompiler directives.

Prashant Pimpale
  • 10,349
  • 9
  • 44
  • 84
user432578
  • 155
  • 1
  • 7
0

It happens when compile cash has damaged or isn't match with application. There are two fix to this issue:

  • 1st is to republish the project to IIS.
  • 2th is moving web.config file in root to somewhere else refresh browser and move it back. It make IIS reset the application and clear it's compile cache.
MSS
  • 3,520
  • 24
  • 29