更新Production ASP.NET网站bin文件夹中的DLL [英] Updating a DLL in a Production ASP.NET Web Site bin folder

查看:172
本文介绍了更新Production ASP.NET网站bin文件夹中的DLL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在生产Web应用程序中更新类库(单个DLL文件).该Web应用程序已预先编译(发布).我在StackOverflow上阅读了一个答案(对不起,由于Search函数不能很好地工作,似乎找不到了),这使我相信我可以将新的DLL粘贴到bin文件夹中,然后将其选中没有问题(这将导致WP回收,这对我很好,因为我们不使用InProc会话状态).

I want to update a class library (a single DLL file) in a production web application. This web app is pre-compiled (published). I read an answer on StackOverflow (sorry, can't seem to find it anymore because the Search function does not work very well), that led me to believe that I could just paste the new DLL in the bin folder and it would be picked up without problems (this would cause the WP to recycle, which is fine with me because we do not use InProc session state).

但是,当我尝试此操作时,我的站点崩溃了,并给出了FileLoadException,它表示程序集清单定义与程序集引用不匹配.这到底是什么?在Visual Studio中更新DLL并重新部署整个站点可以很好地工作,但这在后面是一个巨大的痛苦.如果您必须重新部署整个站点以实施任何更改,那么拥有单独的DLL有什么意义?

However, when I tried this, my site blows up and gives a FileLoadException saying that the assembly manifest definition does not match the assembly reference. What in the world is this?! Updating the DLL in Visual Studio and re-deploying the entire site works just fine, but it is a huge pain in the rear. What is the point of having a separate DLL if you have to re-deploy the entire site to implement any changes?

这里是问题:如何在不破坏应用程序且不重新部署所有文件的情况下更新生产网站上的DLL?

Here's the question: How can I update a DLL on a production web site without breaking the app and without re-deploying all of the files?

推荐答案

要记住的是,就Visual Studio和考虑使用ASPNET.

The thing to remember is that there are web sites and web applications as far as Visual Studio and ASPNET is considered.

网站通常会将所有的aspx和vb文件发布到实时服务器,并且ASPNET Worker Process每次在演示之前都会重新编译应用程序.

Web Sites typically have all of the aspx and vb files published to the live server and ASPNET Worker Process recompiles the app every time before presentation.

另一端是Web应用程序,其中文件后面的所有代码都被编译成一个DLL文件,您只需部署aspx页面,然后将带有DLL文件的文件夹bin到生产环境中.

On the other end is the web application, where all of your code behind files get compiled down to a single DLL file and you simply deploy your aspx pages and you bin folder with the DLL file to production.

还有一个称为"预编译的网站"(请参见MSDN官方概述的链接),您没有Web应用程序的单个DLL布局,但是该网站的所有编译工作均已为您完成.有多种模式",具体取决于您的需求.

There is also a "hybrid" known as "Precompiled Web Sites" (see the link for the official MSDN overview) where you don't have the single DLL layout of a web application, but all the compile work of the website is done for you. There are several "modes" to this depending on your needs.

在我看来,您的错误是由于您的网站设置为已进行某种预编译的网站而引起的.使用预编译的模型要严格一些,因为它假定某些文件/签名已经到位.由于预编译需要该文件的名称和版本,因此拥有DLL文件的更新版本会导致中断.

It seems to me that your error is caused because your site is set up as a web site with some kind of precompilation in place. Using the pre-compiled model is a little more "strict" in that is assumes certain files/signatures are in place. Having an updated version of the DLL file causes a break since the precompilation wants a name and a version of the file.

如果可能的话,最好的选择是转换为Web应用程序,因为您可以毫无问题地将其他DLL添加到生产中.否则,请查看此矩阵来查看您的应用程序需要哪种形式的预编译.

If possible, your best bet would be to convert to a web application, since you can add the additional DLLs into production without a problem. Otherwise, take a look at this matrix to see what form of precompilation you need for your application.

这篇关于更新Production ASP.NET网站bin文件夹中的DLL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆