ASP.NET 如何处理部署
我只能了解到 ASP.NET 检测到特定文件(如 aspx 文件、DLL 等)的更改。它将自行重新启动,完成当前正在运行的请求以及使用新部署的文件的新请求。
但是从第一个文件被复制到最后一个文件被交换期间发生了什么?如果我交换第一个 DLL 文件,则会收到请求,但其他 DLL 文件是旧版本 - 它会崩溃吗? asp.net 是否会等待几秒钟,并且仅在 X 秒没有(相关)文件更改后才重新启动?
谢谢!
i was only able to read up that ASP.NET detects changes to specific files like aspx files, DLLs and others. It will restart itself, finish current running requests and new requests with the new deployed files.
But what is happening in the time from the first file beeing copied till the last one has been exchanged? If i exchange the first DLL file, then a request comes in but the other DLL files are in an older version - will it just crash? Will asp.net wait for some seconds and only starts itself new after X seconds of no (relevant) file changes?
Thx!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您在这里有 4 个问题:
从第一个文件被复制到最后一个文件被交换期间发生了什么? - .net 在启动之前有一个设定的时间等待查看是否有任何其他文件已被修改加载新 dll 的新应用程序域。
如果我交换第一个 DLL 文件,则会收到请求,但其他 DLL 文件是旧版本 - 它会崩溃吗? - 这取决于 DLL 中的代码更改。如果新的 dll 可以与旧代码一起正常运行,那就没问题了。但是,如果应用程序域启动新的 DLL,并且该新的 DLL 依赖于尚不存在的东西......那么它会抛出异常。
asp.net 是否会等待几秒钟,并在 X 秒没有(相关)文件更改后才重新启动? - 是的。我没能查出这个时间有多长。但根据我个人的经验,它大约在 1-2 秒范围内。
我还在这里找到了关于应用程序域和 DLL 重新加载的很好的解释:
http://odetocode.com/Articles/305.aspx
You have 4 questions here:
What is happening in the time from the first file beeing copied till the last one has been exchanged? - There is a set time while .net waits to see if any other files have been modified before it starts up the new app domain with the new dll's loaded.
If i exchange the first DLL file, then a request comes in but the other DLL files are in an older version - will it just crash? - It depends on what code changes are in the dll's. If the new dll can run fine with old code then it will be fine. But if the app domain spins up the new DLL and that new dll is dependent on something that isn't there yet... then yes it will throw an exception.
Will asp.net wait for some seconds and only starts itself new after X seconds of no (relevant) file changes? - Yes. I haven't been able to find how long that time is. But in my personal experience it's somewhere in the 1-2 second range.
I also found a good explanation here on app domain and re-loading of DLL's:
http://odetocode.com/Articles/305.aspx