New article on OdeToCode: Precompilation in ASP.NET 2.0. Here is an excerpt:
Although pre-compilation will give our site a performance boost, the difference in speed will only be noticeable during the first request to each folder. Perhaps a more important benefit is the new deployment option made available by pre-compilation - the option to deploy a site without copying any of the original source code to the server. This includes the code and markup in aspx, ascx, and master files.
Other notes:
It seems the precompile.axd 'magic page' touted as a feature in the early days has slipped quietly into the bucket of dropped features.
Although pre-compilation allows you to deploy a web application without any ASPX files present, this still poses a problem if a request comes in for a directory and you want the request to find a default document for the directory. The 'default document' issue has been a thorn in the side of url-rewriters for quite some time.
If you try to pre-compile to a target directory that already contains a pre-compiled application, the aspnet_compiler will fail with “error ASPRUNTIME: Object reference not set to an instance of an object”. Ugh - unhelpful. Use the –f switch in this case to force an overwrite.
Comments
i wrote a small and easy deployment Tool for that matter. It always compiles by using -v:
http://www.sunlab.de/Tools.aspx
Tool updated to v1.2
First thig first, It is an excellent article and I thank you for making it so simple.
I downloaded Microsoft visual web developer, bcos it had asp.net version2. I did the "Pre-compilation For Deployment" option and copied the target directory into a staging machine. My staging machine still has asp.net version 1.1. I am not able to view the pages online. That is when I visit the pages I stored in the staging machine it gives the "Marker file" Infomation.
Do I have to do some setting on the IIS with respect to asp versioning.
Do I have to install Asp.Net version2 on the staging machine.
What am I doing wrong here?
Please help.
And thanks once again for an excellent article.
Regards,
zia
Does any one have any idea's ?
msdn.microsoft.com/.../default.aspx
Does anyone have any ideas as to what I am doing wrong?
Got to the following folder
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727
type aspnet_regiis -i
ken
Thanks and Regards,
Sasikumar.
I think this article is great.
My only problem is that it does not work for me. I cannot figure out what I am doing wrong
since I do exactly as you demonstrated in this article, but all I get is an empty destination
folder!!! Please help. What am I doing wrong?
Try deleting the folders under the ASP.NET Temporary Files folder and trying again. I've heard this solves the problem for some people, although I've never seene this problem myself.
that being said, why does the precompiler include my .sln, .resx, and the various visual source-safe files in the target/output directory?
it seems a bit strange that I have to delete this files manually before depoying them to the server...
thanx -- /chris
Yes, I am using it from the command-line but from what I can recall the Publish command was doing the same thing.
I just posted a question in the dotnet.framework.aspnet newsgroup about this so maybe I'll get some help there...
What is going wrong? thank you for answer
Hi
I am stuck in the same place as some people already noticed here.
I have XCopied and trying to run the site. But it displays 'This is a marker file genreated by pre-compilation tool and should not be deleted.'
I am struggling to implement ASP.NEt 2.0 application on custom web server for a long time...But still.... Please give your suggestions.
Thank you
Geetha
grajasekaran@auanet.org
Error 1 This application is already precompiled. /
How do I get the application to re-build or re-compile itself? The renamed dlls are in the /bin directory - do I need to get rid of those?
If it makes any difference, I'm using the VS "Publish" version of the precompiler.
Thanks!
Paul
pnoe@identitraktech.com
Geetha: Are you sure you have the virtual directory setup for ASP.NET 2.0 and not 1.1?
This virtual directory is pointing to the target folder where the precomiled files are.
Any help please..
Thank you very much.
Sorry for the delay, but I've been working in SQL 2005 Rptg Svcs for the last two days and haven't gotten back to VS 2005 since.
Thanks for any help you might be able to provide!
now what if i have to deploy the application on one m/c n make it accessible fom other m/c. it works on Windows authentication...it gives me error in aunthentication.i m in the same domian.
First, there were some genial ideeas brought by the Delphi architect, hired by MS...."xcopy" was one of them.
Then Bill said that things need to be scrwed up, and they invented precompilation and other unnatural stuff...
The recent "Web application project" prooves that in the end, they realised what a huge mistake they made...
First, I was using the "Add web deployment proyect" and the additional setup project, then I removed them from the solution.
Now I cannot build my project :-(((
I agree with the rest of the people saying VS2005 is making us work more (bye bye productivity) just to have what we already had.
One dll per page that always changes its name? Oh my...
Thanks.
MS often try to force things beyond their times, resulting unnatural features.
A professional will always want low level access to files to see what he is doing, I don't need fancy tools that masks operations...
I don't want my site dlls hidden deep in windows directory or somewhere else...
They tried to get rid of the old "DLL Hell", now they are making huge steps to create a bigger one.
I'm using VWE 2005 for my developments.
and i couldn't find "Publish Web Site" option in my IDE. Therefore, what I did was pre complied the application with aspnet_compiler.exe
then I moved and run the application once finished copying my files to the production server
But now i get this strange error.
" System.Web.HttpException: The file '/MyWeb/Default.aspx' has not been pre-compiled, and cannot be requested. "
No .asxp files have been changed after pre-complied.
Pls help me to solve this problem.
Thx & BR
Ranga
Thanks for the excellent article. I have a quesiton and I was wondering if you have experience this.
I have vb code in the app_code directory. This vb code looks into the database to grab the masterpage. This allows user to make changes on the appearance on real time. If I don't compile the site, everything works. But if I compile it to the staging directory, it keeps telling me "The file '/user/staging/templates/test.master' does not exist.". It doesn't seemed like it understands the virtual path or it didn't do a full compile.
You have mentioned in your article that masterpages are compiled into the bin directory. Do you know if this is supported?
Ideas/thoughts are greatly appreciated.
You are using a VirtualPathProvider?
I'm pretty sure I've heard that pre-compilation does not work with VirtualPathProviders, it is something the ASP.NET team decided they couldn't support in time for the 2.0 release. I'm not 100% positive about this, but I'm pretty sure I've heard an MS person mention it once.
Thanks for the reply. That saves me lots of time on the research. Yes, I am using VirtualPathProvider.
Have a great day!
Erica
Thanks for the nice article. I am migrating my 1.1 web app to 2.0 and it seems to work fine until I'm trying to deploy the web app using 2.0. To my surprise, the web app does not produce .dll anymore. If we need to precompile for deployment, now we have to use this aspnet_compiler.exe. In VS2005 web deployment project does not have an easy way to deploy the compiled web dlls. Am I right? Or am I missing something there...
From your article and my experiening the VS2005, I conclude that we have to use the aspnet_compiler to precompile the website to dlls and then use the deploy project to collect files generated at the target directory that just got created by the aspnet_compiler to make the .msi. Is there an easier way to deploy web dll using the msi than what I just described?
I wonder such necessary step was not built in by VS2005 after all those fancy convienent GUI were added in VS2005.
Thanks,
frustrated user
Xiang
Yes, ASP.NET 2.0 is a bit different now. If you deploy all your .aspx and .cs/.vb files, ASP.NET can compile everything at runtime.
Another other options is to use the precompiler, or the "Publish" menu option in Visual Studio 2005.
Overall though, it sounds like you want to use the Web Deployment Project add-in:
msdn.microsoft.com/.../wdp/
As a result of compilation, a whole set of files is produced. .resex files are included, as well as a solution file. I know I can delete those. The question that I have is how do I know, which files are not needed for the final deployment of the project. For example in the bin I have the following list of produced files: App_global.asax.compiled, App_WebReferences.compiled, ***.asmx.cdcab7d2.compiled, and ***.dll . I found out by experiment that I can safely delete App_global.asax.compiled and App_WebReferences.compiled (we are using web.config for web references). But as soon as I tried to delete ***.asmx.cdcab7d2.compiled and run withought it, the site crashed. I looked into the file and it looks like this:
<?xml version="1.0" encoding="utf-8"?>
<preserve resultType="2" virtualPath="/SomeName/SomeName.asmx" hash="fffffffff15c6deb" filehash="2e480ddbe903" flags="130000" assembly="SomeName" type="SomeName.SomeName">
<filedeps>
<filedep name="/SomeName/SomeName.asmx" />
</filedeps>
</preserve>
I also noticed that different development machines produce different filehash values. I deleted the hash and filehash keys out of the file, resaved the file and ran the site. The site was fine. So my question is this…. Is it safe to delete .compiled files out of bin? Should we be doing it? If we made a change to the Web Service, should we be replacing all files on the deployment machine, or just the dll?
Thank you.
I'm pretty certain the asp.net runtime needs those compiled files when you have "do not allow updates". I'd deploy the entire set.
One quick question. As per msdn one of the advantages of precompilation is that it protects the UI code from casual observation. But i guess u can still decomile them using professional tools.
Am i right ?
With UI code it is a little different, because you don't get back the declarative markup. The job would be more difficult.
where could i find forsalehomes.dll
i have been used precompilation method.i have faced an error & it is,
web.config(53): error ASPCONFIG: It is an error to use a section registered
as allowDefinition='MachineToApplication' beyond application level. This error
can be caused by a virtual directory not being configured as an application in I
IS.
so,what is the cause for this error?i have a bunch of projects which are contains group of modules & some of them contains webconfig file. so how can i solve this error?
somewhere i found to use LM/W3SVC/websitenum/ROOT/ path but it's not working.
early response is highly appreciate.
Thank You.
If you are trying to compile on the file system and you have multiple applications nested underneath a directory, then you'll have to switch to using IIS or move those applications into separated folders for compilation.
Hope that makes sense,
I've used the pre-compilation process to deploy a web site. After pre-compilation I got the .compiled and .dll files. I've copied all the files generated to the IIS folder in win 2003 r2, and when I browse the page I get the following exception:
System.Web.HttpException: The file '/mySite/Default.aspx' has not been pre-compiled, and cannot be requested.
I've pre-compiled with VS 2008, I've selected "use fixed naming and single paging..." and de-selected "allow this precompiled site to be updateable".
I appreciate any help.
Thanks in advance.
Regards.
What is going wrong? thank you for answer
Hi
i am italian please reply with example.
What is going wrong? thank you for answer
Hi
i am italian please reply with example.
Its a great article, i am a new developer so it is very knowledgeable for me.I want to know about a book for ASP.Net4.0,at present i m refering Apress(Mc Donald) and ASP.Net4.0(Kanjilal).
i will be thankful to you.