4

我正在建立一个网站,主要用于我的内部网络。我在使用 AJAX .NET 时遇到了一个非常令人沮丧的问题。为了解释这个问题,首先让我详细介绍一下我的环境。

我正在 Visual Studio .NET 2010 中开发,目标是 .NET 框架 4.0。我的登台服务器是安装了 IIS 7 的完整配置的 win7 终极机器。
我使用 MySql Server 5.1 作为我的数据库服务器 登台服务器安装了所需的 MySQL 连接器 我正在使用 Membership 类对我的用户进行身份验证和授权。使用 mysql,我按照这篇文章来完成此操作:http://www.codeproject.com/KB/database/mysqlmembershipprovider.aspx 登台服务器使用 AVG 防病毒软件和 Windows 防火墙。我在所有页面上都使用了 toolKitScriptManager。

该应用程序在 Visual Studio 中运行良好。此外,当部署在登台服务器上时,它也可以在登台服务器上的任何浏览器上正常工作。当我通过绑定服务器的 ip adderess:port 访问它时,该网站在我网络内的其他机器上也可以正常工作。现在的问题是,在使用一段时间后,网站就会挂起。正如它所说的页面加载很长一段时间才最终超时。如果我清除缓存并重新启动浏览器,此问题就会消失,但一段时间后会再次出现。此问题仅在联网机器上出现。我们从未在登台服务器的 Web 浏览器上遇到过它。

我已经成功地控制了这个问题的重现。每当页面加载并且我在页面上点击刷新时,就会出现问题。如果我返回并尝试通过单击页面链接访问同一页面,它会起作用。但是如果我点击刷新,页面就会一直说加载并最终超时。

我使用 google chrome 开发人员工具栏和 firebug 检查了网络,发现每当出现问题时,一些 webresource.axd 和 scriptresource.axd 文件都会显示为“待处理”。

在花了超过 15 天的时间研究谷歌来解决这个问题后,我尝试了以下补救措施,但没有成功:

认为这可能与win 7上的IIS7的并发连接限制有关,我以最小的负载对其进行了测试,即只有一个用户访问该站点。我还监视了 IIS 工作进程以查看请求是否在那里排队,但我没有看到待处理的请求,问题仍然存在。认为这可能与防火墙阻塞有关,我禁用了暂存服务器上的防火墙。问题仍然存在。认为这与我的 web.config 设置有关,我检查了我的 web.config 千次错误,但所有部分都完好无损。请参阅此列表末尾的 web.config 文件以了解任何问题迹象,请您提出建议。

我的 web.config 如下:

    <?xml version="1.0"?>
<configuration>
        <configSections>
                <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
                        <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
                                <sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
                                </sectionGroup>
                        </sectionGroup>
                </sectionGroup>
        </configSections>
        <connectionStrings>
                <add name="ConnString" connectionString="Database=scsbackend;Data Source=localhost;User Id=xxxxx;Password=xxxx"/>
        </connectionStrings>
        <system.web>
                <sessionState mode="InProc" timeout="90000"></sessionState>
                <authorization>
                        <allow roles="Admin"/>
                        <allow roles="Tellecaller"/>
                        <deny users="?"/>
                </authorization>
                <authentication mode="Forms"/>
                <roleManager defaultProvider="MySqlRoleProvider" enabled="true" cacheRolesInCookie="true" cookieName=".ASPROLES" cookieTimeout="90000" cookiePath="/" cookieRequireSSL="false" cookieSlidingExpiration="true" cookieProtection="All">
                        <providers>
                                <clear/>
                                <add name="MySqlRoleProvider" type="Andri.Web.MySqlRoleProvider" connectionStringName="ConnString" applicationName="mysqlmembership" writeExceptionsToEventLog="true"/>
                        </providers>
                </roleManager>
                <membership defaultProvider="MySqlMembershipProvider" userIsOnlineTimeWindow="15">
                        <providers>
                                <clear/>
                                <add name="MySqlMembershipProvider" type="Andri.Web.MySqlMembershipProvider" connectionStringName="ConnString" applicationName="mysqlmembership" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true" requiresUniqueEmail="true" passwordFormat="Hashed" writeExceptionsToEventLog="true"/>
                        </providers>
                </membership>
                <pages validateRequest="false">
                        <controls>
                                <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
                        </controls>
                        <tagMapping>
                                <add tagType="System.Web.UI.WebControls.CompareValidator" mappedTagType="Sample.Web.UI.Compatibility.CompareValidator, Validators, Version=1.0.0.0"/>
                                <add tagType="System.Web.UI.WebControls.CustomValidator" mappedTagType="Sample.Web.UI.Compatibility.CustomValidator, Validators, Version=1.0.0.0"/>
                                <add tagType="System.Web.UI.WebControls.RangeValidator" mappedTagType="Sample.Web.UI.Compatibility.RangeValidator, Validators, Version=1.0.0.0"/>
                                <add tagType="System.Web.UI.WebControls.RegularExpressionValidator" mappedTagType="Sample.Web.UI.Compatibility.RegularExpressionValidator, Validators, Version=1.0.0.0"/>
                                <add tagType="System.Web.UI.WebControls.RequiredFieldValidator" mappedTagType="Sample.Web.UI.Compatibility.RequiredFieldValidator, Validators, Version=1.0.0.0"/>
                                <add tagType="System.Web.UI.WebControls.ValidationSummary" mappedTagType="Sample.Web.UI.Compatibility.ValidationSummary, Validators, Version=1.0.0.0"/>
                        </tagMapping>
                </pages>
                <!--
          Set compilation debug="true" to insert debugging
          symbols into the compiled page. Because this
          affects performance, set this value to true only
          during development.
    -->
                <compilation debug="false" targetFramework="4.0">
                        <assemblies>
                                <add assembly="System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
                                <add assembly="MySql.Data, Version=5.2.3.0, Culture=neutral, PublicKeyToken=C5687FC88969C44D"/>
                                <add assembly="System.Transactions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
                                <add assembly="System.Configuration.Install, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
                                <add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
                                <add assembly="System.Web.Extensions.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
                                <add assembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
                                <add assembly="Accessibility, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
                                <add assembly="System.Runtime.Remoting, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
                                <add assembly="System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
                                <add assembly="Accessibility, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
                                <add assembly="System.Web.ApplicationServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
                                <add assembly="System.ServiceModel.Activation, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
                                <add assembly="System.Runtime.Serialization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
                                <add assembly="System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
                                <add assembly="System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
                                <add assembly="System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
                                <add assembly="System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
                                <add assembly="System.Web.Services, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
                                <add assembly="System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
                                <add assembly="System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
                                <add assembly="System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
                                <add assembly="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
                                <add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
                                <add assembly="System.ServiceModel.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
                                <add assembly="System.Data.Services.Client, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
                                <add assembly="System.Data.Services.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
                                <add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
                                <add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/></assemblies>
                </compilation>
                <httpHandlers>
                        <remove verb="*" path="*.asmx"/>
                        <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
                </httpHandlers>
                <httpModules>
                        <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
                </httpModules>
        </system.web>
        <location path="Default.aspx">
                <system.web>
                        <authorization>
                                <allow roles="Admin"/>
                                <allow roles="Tellecaller"/>
                        </authorization>
                </system.web>
        </location>
        <location path="SCS_Webcontrol.aspx">
                <system.web>
                        <authorization>
                                <allow roles="Admin"/>
                                <allow roles="Tellecaller"/>
                        </authorization>
                </system.web>
        </location>
        <location path="M/scs.aspx">
                <system.web>
                        <authorization>
                                <allow roles="Admin"/>
                                <deny roles="Tellecaller"/>
                        </authorization>
                </system.web>
        </location>
        <location path="SCS_Reports.aspx">
                <system.web>
                        <authorization>
                                <allow roles="Admin"/>
                                <deny roles="Tellecaller"/>
                        </authorization>
                </system.web>
        </location>
        <location path="Webcontrol_WebService.asmx">
                <system.web>
                        <authorization>
                                <allow users="?"></allow>
                        </authorization>
                </system.web>
        </location>
        <system.webServer>
                <validation validateIntegratedModeConfiguration="false"/>
                <modules runAllManagedModulesForAllRequests="true">
                        <add name="ScriptModule" preCondition="integratedMode" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
                </modules>
                <handlers>
                        <remove name="WebServiceHandlerFactory-ISAPI-2.0"/>
                        <add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
                        <add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
                </handlers>
        </system.webServer>
</configuration>
4

0 回答 0