IIS 预热 (8.0及8.0以上版本)

The two new additions in IIS 8 are

image

Preload Enabled

This setting is available if you have the Application Initialization module installed

image

The preloadEnabled metabase setting along with the startMode setting can be used to ‘warm up’ your web application.

When you set the startMode property of your application pool to AlwaysRunning a worker process is spawned as soon as IIS starts up and does not wait for the first user request. But this does not mean the web application is initialized.

When you set preloadEnabled to true, IIS will simulate a user request to the default page (can be changed with initializationPage metabase setting) of the website/virdir so that the application initializes. The request is not logged in the IIS logs.

But you can trace this with FREB. Every time you restart your application pool you will see a FREB trace file for the dummy request. You can identify this request by analysing the GENERAL_REQUEST_HEADERS and looking at the User-Agent string.

User-Agent: IIS Application Initialization Preload

 

Maximum Url Segments

With the maxUrlSegments metabase setting you can control the number of segments in an URL that your web application can serve. A segment is nothing but the number of / in your URL. This is a security setting that you can use to control the depth to which a user can browse your website.

So for example say you have an application whose URL are mostly of the format http://website/virdir/page,  you can set the maxUrlSegments to 3. This stops probing attacks.

If a user tries to browse an URL with segments exceeding this limit he/she will see a 404 message and a 404.20 HTTP status code will be logged in the IIS logs.

Tags  IIS
 
 
C# Codeing:
 
//When App Start

using (var dbcontext = new DBEntities())
{
var objectContext = ((IObjectContextAdapter)dbcontext).ObjectContext;
var mappingCollection = (StorageMappingItemCollection)objectContext.MetadataWorkspace.GetItemCollection(DataSpace.CSSpace);
mappingCollection.GenerateViews(new List<EdmSchemaError>());
}

转载于:https://www.cnblogs.com/Johnson-zhao/p/9046667.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值