本文介绍了ASP.NET中的VB.NET问题:IIS 7和IIS 6托管之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我们有一个用VB.NET编写的大型ASP.NET应用程序,我们接管了它。 span style =""> 它针对.NET 4.0 SP1框架运行并命中SQL 2008数据库服务器。 它是一个非常标准的WebForms / ASPX项目,虽然非常大(100多种网络表单)。 在我们的开发和测试环境中,应用程序运行良好,所有功能测试都很好。 我们的开发环境是Win7,VS 2010和ASP.NET开发者网络服务器。 我们的测试/预生产环境是带有IIS 7的Windows 2008 R2服务器。 所有环境都是64位。We have a large ASP.NET application written in VB.NET that we have taken over. It is running against the .NET 4.0 SP1 framework and hits a SQL 2008 database server. It’s a pretty standard WebForms/ASPX project albeit very large (100+ web forms). In our development and test environments the application runs perfectly and all functionality tests out fine. Our dev environments are Win7, VS 2010, and the ASP.NET dev web server. Our testing/pre-production environments are Windows 2008 R2 Servers with IIS 7. All environments are 64-bit. 当我们尝试将此代码推送到由Win 2003服务器和IIS 6组成的生产环境时,我们最近遇到了一个非常重要的问题。 此代码的原始开发人员在打字时非常松懈,代码中充斥着各种不安全的演员表和奇怪的转换,例如CType(&ndquo; 2”,Integer)。   在我们的开发环境和我们的测试环境中,这些演员表都很有效,并且没有错误或不需要的行为。 可以说是糟糕的代码,但功能性很强,这种类型的演员阵容如此普遍,以至于删除它们都非常重要。 We have recently run into a pretty major issue when we have attempted to push this code to a production environment that consists of Win 2003 server and IIS 6. The original developers of this code were pretty lax with their typing and the code is littered various unsafe casts and weird conversions such as CType(“2”, Integer). In our development environments and our test environments these casts all work great and there are no bugs or unwanted behavior. It is arguably poor code but functional and this type of cast is so prevalent that removing them all would be pretty significant. 在我们的生产环境(Win2K3 / IIS 6)中,所有这些强制转换失败。 我们已配置多个Win2K3 / IIS6环境,并且能够重现所有错误。 应用程序本身运行但是,在整个应用程序的不同位置,尝试使用不安全的CType,它们都在W2K3 / IIS6中失败 环境,但在其他所有环境中工作。 不幸的是,将生产转换到2008不是一种选择,而且代码库太大,以至于大量修复将耗费时间并且可能容易出错。In our production environments (Win2K3/IIS 6) all of these casts fail. We have configured multiple Win2K3/IIS6 environments and are able to reproduce errors on all. The application itself runs but, at various places throughout the app where an unsafe CType is attempted they all fail in the W2K3/IIS6 environments but work in every other environment. Unfortunately switching production to 2008 is not an option and the code-base is so large that a massive fix will be time consuming and potentially error prone. 我们已经在所有环境中进行了验证: · 代码和SQL部署完全匹配· Code and SQL deployments match exactly · ;  完全匹配的.NET框架(包括服务包)· Exact matching .NET frameworks (including service packs) · ;    精确机器配置’· Exact machine config’s ·   精确的web.configs(超出连接字符串)· Exact web.configs (beyond connection strings) ·     所有IIS设置(至少尽可能多在IIS 6和7)中的虚拟目录之间进行比较· All IIS settings (at least as much as can be compared between a virtual directory in IIS 6 and 7) · 所有测试/生产/和开发环境都是64 -bit。· All test/production/and Dev environments are 64-bit. 似乎IIS 6在Option Explicit或Strict中运行或执行具有不同验证级别的代码。 我们无法在机器或 web配置中找到任何内容(没有Strict =" True"或Explicit =" True")或任何其他可能导致此问题的框架设置。 有没有人经历过这样的事吗? 在IIS6与IIS7或64位W2K3盒与W2K8盒中托管的ASP.NET应用程序中是否存在任何已知差异? 你建议我们去哪儿看看?Has anyone experienced anything like this? Any known differences in an ASP.NET app being hosted in IIS6 vs. IIS7 or on a 64-bit W2K3 box vs. W2K8 box? Anywhere you would recommend we look?推荐答案 在IIS服务器上运行的程序集实际上与VB无关,它只是一个包含中间件的DLL。网络代码,与C#相同,托管C ++,F#或其他。 Your assembly running in the IIS server has in fact nothing more to do with VB, it is simply a DLL which contains intermediate .Net code, the same as for C#, managed C++, F# or whatever. 我只能在你的问题中找到一个VB,那就是转换 I could only find one thing which is VB in your question, and that is the conversion CType(&ndquo; 2”,Integer) 就像你说的那样奇怪,但机会很低,它是你的问题的结果,它甚至可能在IL中运行在CLR&n中进行优化bsp;但这应该意味着这个版本在XP上也会出错,并且XP上有很多VB开发人员相信情况确实如此。But that should mean this casting would also go wrong on XP, and there are to much VB developers on XP to believe that this is the case.访问IIS论坛也许是明智之举,但在我的想法中你不应该专注于这个代码的转换/转换(当然不是那么愚蠢) )可能是存在最多的铸造Maybe is it wise to visit the IIS forum, but in my idea you should not focus on this casting/conversion as that piece of code (not so stupid of course) is probably the most done casting which exists CInt(TextBox.Text)CInt(TextBox.Text)如果文本框包含2,则它与CType相同("2",整数)If the textbox contains a 2 than it is the same as CType("2",Integer) http://forums.iis.nethttp://forums.iis.net 这篇关于ASP.NET中的VB.NET问题:IIS 7和IIS 6托管之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 08-31 00:14