我可以在我的开发环境中上传文件 - VS2013 VB.Net - 但是当我将它移动到测试或生产服务器时,UploadComplete
事件不会触发。我更新了两个Web.config文件中的<handlers>
和<httpHandlers>
部分。我可以告诉该方法没有被调用,因为我把它写入日志文件。我已经为目标上传目录分配了读/写权限。我使用的是AjaxControlToolkit v16.1.0.0我的测试服务器是Windows Server 2012 R2,生产服务器:Windows Server 2008 R2
任何想法接下来要尝试什么?
编辑:对不起,我不打算投射出神秘的气息。我没有附加代码,因为代码在Dev Env中的PC上工作,所以我认为这不是问题 - 更可能是IIS或服务器的东西......但是ASPX文件有这个:
<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="ajaxToolkit" %>
<ajaxToolkit:AjaxFileUpload ID="AjaxFileUpload1" runat="server"
AllowedFileTypes="xlsx,xls" OnClientUploadComplete="uploadComplete"
MaximumNumberOfFiles="1" IsInFileUploadPostBack="false"
ClearFileListAfterUpload="true" />
未被调用的服务器端事件处理程序声明为:
Private Sub AjaxFileUpload1_UploadComplete(sender As Object, e As AjaxFileUploadEventArgs) Handles AjaxFileUpload1.UploadComplete
Web.config包含处理程序:
<handlers>
<remove name="ChartImageHandler"/>
<add name="ChartImageHandler" preCondition="integratedMode" verb="GET,HEAD,POST" path="ChartImg.axd" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add name="ReportViewerWebControlHandler" preCondition="integratedMode" verb="*" path="Reserved.ReportViewerWebControl.axd" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91"/>
<add name="AjaxFileUploadHandler" verb="*" path="AjaxFileUploadHandler.axd" type="AjaxControlToolkit.AjaxFileUploadHandler, AjaxControlToolkit"/>
</handlers>
和
<httpHandlers>
<add path="ChartImg.axd" verb="GET,HEAD,POST" type="System.Web.UI.DataVisualization.Charting.ChartHttpHandler, System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" validate="false"/>
<add path="Reserved.ReportViewerWebControl.axd" verb="*" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" validate="false"/>
<add verb="*" path="AjaxFileUploadHandler.axd" type="AjaxControlToolkit.AjaxFileUploadHandler, AjaxControlToolkit"/>
</httpHandlers>