如何使用asp.net在sqlserver R2 2008中上传大型excel文件? [英] How to upload a large excel file in sqlserver R2 2008 using asp.net?
本文介绍了如何使用asp.net在sqlserver R2 2008中上传大型excel文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想上传一个大的excel文件可能是aprx 30-40mb。怎么做?
一次又一次地出现此错误
超时已过期。操作完成前经过的超时时间或服务器没有响应。
网络配置
<! -
有关如何配置ASP.NET应用程序的更多信息,请访问
http: // go.microsoft.com/fwlink/?LinkId=169433
- >
< configuration>
< appSettings>
< add key = FolderPath value = Files / />
< / appSettings >
< connectionStrings>
< add name = Excel03ConString connectionString = Provider = Microsoft.Jet.OLEDB.4.0;数据源= {0};扩展属性='Excel 8.0; HDR = {1}'跨度> />
< add name = Excel07ConString connectionString = Provider = Microsoft.ACE.OLEDB.12.0;数据源= {0};扩展属性='Excel 8.0; HDR = {1}'跨度> />
< add name = conString connectionString = 数据源= TPD-PC; database = scrub; Integrated Security = true; Connect Timeout = 1000200; pooling ='true'; Max Pool Size = 22200 跨度> />
< / connectionStrings >
< system.web>
< httpRuntime executionTimeout = 500 maxRequestLength = 65536 useFullyQualifiedRedirectUrl = false minFreeThreads = 8 minLocalRequestFreeThreads = 4 appRequestQueueLimit = 10000 enableVersionHeader = true />
<! -
设置编译debug = true将调试
符号插入编译页面。由于此
影响效果,设置 此 value 到 true 仅在开发期间
。
- >
< compilation debug = true >
< assemblies>
< add assembly = 系统。 Web.Extensions,Version = 1.0.61025.0,Culture = neutral,PublicKeyToken = 31BF3856AD364E35 />
< add assembly = 系统。 Design,Version = 2.0.0.0,Culture = neutral,PublicKeyToken = B03F5F7F11D50A3A />
< add assembly = 系统。 Web.Extensions.Design,Version = 1.0.61025.0,Culture = neutral,PublicKeyToken = 31BF3856AD364E35 />
< add assembly = 系统。 Windows.Forms,Version = 2.0.0.0,Culture = neutral,PublicKeyToken = B77A5C561934E089 />
< / 议程 >
< / 编译 >
<! -
< authentication> section启用
ASP.NET使用的安全身份验证模式的配置
来标识传入用户。
- >
<身份验证模式= Windows />
<! -
< customErrors>如果/当在执行请求期间发生未处理的错误
时,部分启用配置
的 do 。具体来说,
它使开发人员能够配置html错误页面
,以便在错误堆栈跟踪的位置显示。
< customErrors mode = RemoteOnly defaultRedirect = GenericErrorPage.htm >
< ; error statusCode = 403 redirect = NoAccess.htm />
< error statusCode = 404 redirect = FileNotFound.htm />
< / customErrors >
- >
< / system.web >
< / configuration >
解决方案
你必须使用命令超时属性来增加超时。
你可以设置最大值你想要的。
例如cmd.CommandTimeout = 900 ;
Hey guys please help me out of this problem....!!
I want to upload a large excel file may be aprx 30-40mb.How to do this?
Getting this error again and again
"Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding."
Web config
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<appSettings>
<add key="FolderPath" value="Files/"/>
</appSettings>
<connectionStrings>
<add name="Excel03ConString" connectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};Extended Properties='Excel 8.0;HDR={1}'"/>
<add name="Excel07ConString" connectionString="Provider=Microsoft.ACE.OLEDB.12.0;Data Source={0};Extended Properties='Excel 8.0;HDR={1}'"/>
<add name="conString" connectionString="Data Source=TPD-PC;database=scrub;Integrated Security=true;Connect Timeout=1000200; pooling='true'; Max Pool Size=22200"/>
</connectionStrings>
<system.web>
<httpRuntime executionTimeout="500" maxRequestLength="65536" useFullyQualifiedRedirectUrl="false" minFreeThreads="8" minLocalRequestFreeThreads="4" appRequestQueueLimit="10000" enableVersionHeader="true"/>
<!--
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="true">
<assemblies>
<add assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="System.Web.Extensions.Design, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
</assemblies>
</compilation>
<!--
The <authentication> section enables configuration
of the security authentication mode used by
ASP.NET to identify an incoming user.
-->
<authentication mode="Windows"/>
<!--
The <customErrors> section enables configuration
of what to do if/when an unhandled error occurs
during the execution of a request. Specifically,
it enables developers to configure html error pages
to be displayed in place of a error stack trace.
<customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
<error statusCode="403" redirect="NoAccess.htm" />
<error statusCode="404" redirect="FileNotFound.htm" />
</customErrors>
-->
</system.web>
</configuration>
解决方案
Hi,
You have to increase timeout using command timeout property .
you can set max value if you want.
e.g.cmd.CommandTimeout = 900;
这篇关于如何使用asp.net在sqlserver R2 2008中上传大型excel文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文