会员
周边
众包
新闻
博问
闪存
所有博客
当前博客
我的博客
我的园子
账号设置
简洁模式
...
退出登录
注册
登录
技术已荒废
生活的理想,是为了理想的生活!
---->>Nothing is impossible for a willing heart.
博客园
::
首页
::
博问
::
闪存
::
新随笔
::
联系
::
订阅
::
管理
::
公告
了解web.config
如何配置web.config文件,进行大数据量文件的传输?
应用程序配置文件包含应用程序特定的设置。该文件包含公共语言运行库读取的配置设置(如程序集绑定策略、远程处理对象等等),以及应用程序可以读取的设置。
应用程序配置文件的名称和位置取决于应用程序的宿主,可以是下列情况之一:
可执行文件承载的应用程序。
由可执行文件宿主承载的应用程序的配置文件与该应用程序位于同一目录。配置文件的名称是带有 .config 扩展名的该应用程序的名称。例如,名为 myApp.exe 的应用程序可以与名为 myApp.exe.config 的配置文件关联。
ASP.NET 承载的应用程序。
有关 ASP.NET 配置文件的更多信息,请参见 ASP.NET 配置
Internet Explorer 承载的应用程序。
如果 Internet Explorer 承载的应用程序有配置文件,那么该文件的位置在
<
link
>
标记中指定,其语法如下:
<
link rel
=
"
ConfigurationFileName
"
href
=
"
location
"
>
在该标记中,location 是指向该配置文件的 URL。它设置了应用程序基。配置文件必须位于与应用程序所在的同一网站中。
下面是一个简单的web.config文件代码:
<?
xml version
=
"
1.0
"
?>
<!--
注意: 除了手动编辑此文件以外,您还可以使用
Web 管理工具来配置应用程序的设置。可以使用 Visual Studio 中的
“网站”
->
“Asp.Net 配置”选项。
设置和注释的完整列表在
machine.config.comments 中,该文件通常位于
\Windows\Microsoft.Net\Framework\v2.x\Config 中
-->
<
configuration
>
<
appSettings
>
<
add key
=
"
WebReference.Service
"
value
=
"
http://10.72.25.164/WS/Service.asmx
"
/>
</
appSettings
>
<
connectionStrings
/>
<
system.web
>
<!--
设置 compilation debug
=
"
true
"
将调试符号插入
已编译的页面中。但由于这会
影响性能,因此只在开发过程中将此值
设置为
true
。
-->
<
compilation debug
=
"
true
"
>
<
assemblies
>
<
add assembly
=
"
System.Data.OracleClient, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089
"
/></
assemblies
></
compilation
>
<!--
通过
<
authentication
>
节可以配置 ASP.NET 使用的
安全身份验证模式,
以标识传入的用户。
-->
<
authentication mode
=
"
Windows
"
/>
<!--
如果在执行请求的过程中出现未处理的错误,
则通过
<
customErrors
>
节可以配置相应的处理步骤。具体说来,
开发人员通过该节可以配置
要显示的 html 错误页
以代替错误堆栈跟踪。
<
customErrors mode
=
"
RemoteOnly
"
defaultRedirect
=
"
GenericErrorPage.htm
"
>
<
error statusCode
=
"
403
"
redirect
=
"
NoAccess.htm
"
/>
<
error statusCode
=
"
404
"
redirect
=
"
FileNotFound.htm
"
/>
</
customErrors
>
-->
<!--<
compilation defaultLanguage
=
"
C#
"
/>-->
<!--
如果为.net SDK
1
.0及以前版本,请删除下边一行
-->
<
pages validateRequest
=
"
false
"
/>
<
globalization fileEncoding
=
"
gb2312
"
responseEncoding
=
"
gb2312
"
requestEncoding
=
"
gb2312
"
/>
<
httpRuntime executionTimeout
=
"
300
"
maxRequestLength
=
"
20480
"
/>
</
system.web
>
</
configuration
>
我们可以通过设置web.config文件来进行传输大数据量文件,上面传输的最大量为20MB,具体可以参照下面的属性进行修改:
<
httpRuntime
executionTimeout
=
"
110
"
maxRequestLength
=
"
4096
"
requestLengthDiskThreshold
=
"
256
"
useFullyQualifiedRedirectUrl
=
"
false
"
minFreeThreads
=
"
8
"
minLocalRequestFreeThreads
=
"
4
"
appRequestQueueLimit
=
"
5000
"
enableKernelOutputCache
=
"
true
"
enableVersionHeader
=
"
true
"
requireRootedSaveAsPath
=
"
true
"
enable
=
"
true
"
shutdownTimeout
=
"
90
"
delayNotificationTimeout
=
"
5
"
waitChangeNotification
=
"
0
"
maxWaitChangeNotification
=
"
0
"
requestPriority
=
"
Normal
"
enableHeaderChecking
=
"
true
"
sendCacheControlHeader
=
"
true
"
apartmentThreading
=
"
false
"
/>
posted on
2006-10-17 15:43
技术已荒废
阅读(
541
) 评论(
0
)
编辑
收藏
举报
会员力量,点亮园子希望
刷新页面
返回顶部