7

I'm using a web deployment project in order to precompile my ASP.NET 3.5 web project. It creates a single extra DLL for the code in aspx and ascx files. And, for every aspx file there is a placeholder aspx file (empty) which needs to be copied to the server.

I'd like to simplify the deployment process. Is there a way (configuring the IIS site and adding some sort of http handlers etc.) to get rid of these aspx placeholders?

Also, I'd like to know if there is a way to get rid of the .compiled files in the bin folder. It would make the deployment process smoother.

Thanks!

splattne
  • 102,760
  • 52
  • 202
  • 249
  • I am assuming the option to convert your website projects to web applications is not available? – cgreeno Jan 08 '09 at 13:44
  • It already IS a web application project. I use the deployment for having that single DLL - so there is no need of the actual aspx, ascx files. – splattne Jan 08 '09 at 13:51

2 Answers2

6

I discovered it by myself. It is much easier than I thought (IIS 6.0):

In Internet Information Manager go to the property page of the site, then chose the tab "Home Directory" and click on the button "Configuration...".

Click "Edit..." for the .aspx ISAPI extension and uncheck "Verify that file exists". At this point, no aspx file is needed anymore.

alt text

Update

One important thing: I had to create an empty "default.aspx" file in the root of the application in order to allow the default document for requests like "http://www.example.com/" (without calling an aspx).

Update 2

Another very important thing: if you're using ASP.NET Ajax PageMethods, then you have to keep the aspx placeholder of that page. If you're omitting the file, a javascript 'PageMethods is undefined' error will be thrown on the browser.

Spooky
  • 2,966
  • 8
  • 27
  • 41
splattne
  • 102,760
  • 52
  • 202
  • 249
  • Thank you, miies. It seems so. If I discover caveats etc. I'll keep you informed in this answer. – splattne Jan 08 '09 at 16:36
  • I'm having some problems with my pagemethods and it has to do with this trick (I used is a while back for url rewrite). I don't understand what you mean my aspx placeholders. Can you explain so i'll be able to fix my problem? Thank you. – Orson Feb 15 '11 at 15:06
  • If you're precompiling your application using the web deployment project, then the actual aspx files aren't needed anymore. (empty) aspx placeholder files are created. – splattne Feb 15 '11 at 15:48
  • Please where can i find the aspx placeholder files. I'm sorry if its so lame. – Orson Feb 15 '11 at 17:26
  • I'm using a website instead of a web application project. – Orson Feb 15 '11 at 17:31
  • I don't think this (placeholder files) applies for website projects (or did you precompile them? that would be unusual...) – splattne Feb 15 '11 at 18:46
  • I'm sorry. I've not heard of aspx placeholder files. Do you know where i could get more insight? – Orson Feb 15 '11 at 21:49
  • placeholder files are not a concept, they're just automatically created because of the way IIS works. http://msdn.microsoft.com/en-us/library/e22s60h9(v=vs.85).aspx – splattne Feb 16 '11 at 07:04
0

IF it is possible, then it will require, at the least, the mapping in IIS of all possible requests to the asp.net engine. Not very difficult. Then, a HttpHandler should be possible to intercept all incoming requests. That handler should then be able to dynamically load compiled page classes and render them. You'd basically have a single engine DLL that serves page content.

But as you might have noticed from all the should's, it's not a simple thing to accomplish, and I doubt that it's really worth the trouble. What exactly is wrong with these placeholder files being present?

user39603
  • 2,235
  • 1
  • 16
  • 13
  • The project has hundreds of aspx files. The deployment (on many servers on different locations) would be much easier if I in could just "copy" the DLLs instead of synchronizing a lot of aspx files... – splattne Jan 08 '09 at 14:43
  • I see you've found a way to do this in IIS. However, take a look at Microsoft's robocopy.exe for future reference. It can automatically mirror complete directory trees, so you won't have to synchronize anything manually. – user39603 Jan 08 '09 at 16:01
  • Yes, I have something similar (syncback). But the problem is: on some servers I have to go FTP and the web deployment project re-creates this aspx files every time. Since I don't know if there are new aspx, I have to compare them every time ... Oh I could tell you hours of the pain I experienced... – splattne Jan 08 '09 at 16:39