错误您要查找的资源可能已被删除,名称已更改或暂时不可用

时间:2017-07-28 21:10:40

标签: asp.net excel vb.net ms-access iis

我有一个asp.net网站,它使用后面的代码中的自定义时间戳查询来计算平均值和标准差,并将结果存储在excel文件中。但每当我点击选择较长的时间帧时,它就会发出此错误。背后的代码如下: -

Protected Sub Button4_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button4.Click
    Response.Clear()
    Response.AddHeader("content-disposition", "attachment;filename=FileName.xls")
    Response.Charset = ""
    Response.ContentType = "application/vnd.xls"
    Dim stringWrite As New System.IO.StringWriter()
    Dim htmlWrite As System.Web.UI.HtmlTextWriter = New HtmlTextWriter(stringWrite)
    GridView6.RenderControl(htmlWrite)
    Response.Write(stringWrite.ToString())
    Response.[End]()
End Sub

从IIS的角度来看,是否需要进行任何更改?

我还在Web.config文件中添加了以下标记,但它给了我同样的错误。

 <system.webServer>
    <modules runAllManagedModulesForAllRequests="true"/>
  </system.webServer>

1 个答案:

答案 0 :(得分:0)

在web.config文件中添加了以下行

 <configuration>
     <system.webServer>
      <security>
      <requestFiltering>
        <requestLimits maxAllowedContentLength="104857600" />
      </requestFiltering>
    </security>
</system.webServer>
    </configuration>