I was a bit cruel over the weekend and decided to upgrade the project to the 2.0 platform. Because VS2003 and 2005 can coexist, the problem is relatively easy to deal with. Install the Pro version of 2005, open the original project, and the upgrade wizard will automatically appear. The project contains 7 sub-projects. All logic and display are implemented in the background project. Each file in the front-end Web project only implements a call to the background method, and no advanced methods are used in the background. syntax, so upgrading is very smooth.
To sum up, the project files in the Web project have been deleted. It turns out that two unrelated ASPX files were also taken into account in the compilation process. I compiled it, uploaded it to the server, and reported an error. Later, I found that the newly compiled project did not have the Dll of the Web project, but it was still there in the server directory. The result is a mess of internal references. Delete the Dll of the old Web project and it's OK.
Then I planned to try the publishing mode. I used the publishing website function in the generate menu item of VS2005 to set the directory to publish to. The option was set to not allow updates. It actually copied everything in the Web directory, so the compilation process was very complicated. slow. After the compilation was completed, a bunch of things were generated in the bin directory. I thought that copying these things to the server would eliminate the need for clean compilation. It turns out that the csc process still appears when the page is accessed for the first time. After the entire website was switched over, there were still a bunch of csc processes, but the compilation process was a little faster than before.
Another serious problem occurred. The program seemed to automatically restart after a while, causing it to be compiled again. Later, an error window appeared on the server, saying that there was an error in the w3wp.exe process. Do you want to debug it? After selecting Cancel, w3wp.exe automatically restarted, and a new round of recompilation began. This process happened three times, and I was so scared that I quickly switched back to version 1.1. I took a look in the event viewer and found a bunch of unhandled exceptions, which were basically errors with empty values. It's strange, there was no problem in 1.1, and the code has not been changed.
Later, I found an article (no one in Chinese seems to have mentioned it), http://www.eggheadcafe.com/articles/20060305.asp . The handling of unhandled exceptions in 2.0 is very different from that in 1.1. is different, 1.1 will ignore it unless it affects page generation. And 2.0 will cause the process to report an error, directly affecting the operation of the entire website. It sounds like a serious problem, but it seems more reasonable, otherwise programmers will continue to ignore this error. However, because of this problem, the inability to switch websites is also a serious problem. Therefore, a smooth transition method is still needed. As mentioned above, this method is to write an HttpModule yourself to handle all unhandled exceptions and record exception information into system events, which is beneficial to programmers for processing. And the source code and binary file download of this HttpModule is also provided above, including the Demo WebApp.
Today I finally understood the compilation method of 2.0 pre-deployment release. It is wrong to use VS to publish the website. You must use aspnet_compiler.exe to compile manually, and its compilation process is based on the actual settings of the website. In other words, you must upload the content of the Web project to the website, set the path of the website in IIS, and then use aspnet_compile to compile. You can compile locally. This process actually puts the generated dll into C: The ones in the cache directory in WindowsMicrosoft.Net are exactly the same as those generated by csc.exe when the user actually accesses the page. After this step, no compilation action will occur when the user visits twice.
So tired. By the way, I thought of a seamless switching method, keeping two websites pointing to two different directories, one of which does not have a host header, and the other has a host header for updating. After updating the website with the host header, use aspnet_compiler to compile it, and then switch the host headers of the two websites, so that newly visited users will be directed to the newly compiled website, and the user will not feel any delay. Just update another site next time.
http://www.cnblogs.com/unfish/archive/2006/09/10/500230.html