有没有办法摆脱 ASP.NET Web 部署项目中的 aspx 占位符文件?
我正在使用Web 部署项目来预编译我的ASP.NET 3.5 Web 项目。 它为 aspx 和 ascx 文件中的代码创建一个额外的 DLL。 并且,对于每个 aspx 文件,都有一个占位符 aspx 文件(空),需要将其复制到服务器。
我想简化部署过程。 有没有办法(配置 IIS 站点并添加某种 http 处理程序等)来摆脱这些 aspx 占位符?
另外,我想知道是否有办法删除 bin 文件夹中的 .compiled 文件。 这将使部署过程更加顺利。
谢谢!
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!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我自己发现的。 这比我想象的要容易得多(IIS 6.0):
在Internet信息管理器中,转到站点的属性页,然后选择“主目录”选项卡并单击“配置...”按钮。
单击 .aspx ISAPI 扩展名的“编辑...”,然后取消选中“验证该文件是否存在”。 此时,不再需要 aspx 文件。
更新
一件重要的事情:我必须创建一个空的“default.aspx”文件在应用程序的根目录中,以便允许默认文档处理“http://www.example.com/ 等请求”(不调用 aspx)。
更新 2
另一件非常重要的事情:如果您使用 ASP.NET Ajax PageMethods,那么您必须保留该页面的 aspx 占位符。 如果您省略该文件,浏览器上将会抛出一个 javascript 'PageMethods is undefined' 错误。
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.
如果可能的话,那么至少需要在 IIS 中将所有可能的请求映射到 asp.net 引擎。 不是很困难。 然后,HttpHandler 应该能够拦截所有传入的请求。 然后,该处理程序应该能够动态加载已编译的页面类并呈现它们。 基本上,您将拥有一个提供页面内容的单一引擎 DLL。
但正如您可能已经从所有应该中注意到的那样,这并不是一件容易完成的事情,而且我怀疑这是否真的值得这么麻烦。 这些占位符文件的存在究竟出了什么问题?
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?