Is there a way to get rid of aspx placeholder files in a ASP.NET web deployment project?

扶醉桌前 提交于 2019-11-29 09:35:36

问题


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!


回答1:


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.

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.




回答2:


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?



来源:https://stackoverflow.com/questions/424230/is-there-a-way-to-get-rid-of-aspx-placeholder-files-in-a-asp-net-web-deployment

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!