我正在建立一个网站,主要用于我的内部网络。我面临着一个非常令人沮丧的AJAX .NET问题。要解释这个问题,首先让我详细说明我的环境。
我在Visual Studio .NET 2010中开发,面向.NET framework 4.0。 我的登台服务器是一台win7 utlimate机器,安装了完整的IIS 7配置 我使用MySql Server 5.1作为我的数据库服务器 登台服务器已安装所需的MySQL连接器 我正在使用Membership类来验证和授权我的用户。使用mysql,我按照这篇文章来完成这个:http://www.codeproject.com/KB/database/mysqlmembershipprovider.aspx 登台服务器正在使用AVG防病毒以及Windows防火墙。 我在我的所有页面上都使用了toolKitScriptManager。
该应用程序在视觉工作室中运行得非常好。此外,当部署在登台服务器上时,它也可以在登台服务器上的任何浏览器上正常工作。当我通过绑定服务器的ip adderess:端口访问它时,该网站在我的网络内的其他机器上也能正常工作。现在的问题是,经过一段时间的使用后,网站就会挂起。正如它在最终超时之前所说的页面加载很长一段时间。如果我清除缓存并重新启动浏览器但在一段时间后重新出现,则此问题就会消失。此问题仅在联网计算机上见证。我们从未在登台服务器的Web浏览器上遇到过它。
我成功地对这个问题进行了有控制的重新编制。每当页面加载并且我点击页面上的刷新时,就会出现问题。如果我返回并尝试通过单击页面链接访问同一页面,它可以工作。但如果我点击刷新,页面就会继续说加载并最终超时。
我使用谷歌浏览器开发人员工具栏和firebug检查了网络,我发现每当问题发生时,一些webresource.axd和scriptresource.axd文件显示为“待定”。
花了超过15天的时间,研究谷歌打击这个问题,我没有成功尝试以下补救措施:
认为它可能与win7上的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>