ASP. NET 4 new features of core runtime for developers in ASP. NET 4

Source: Internet
Author: User

Major improvements to ASP. NET 4 Runtime
Performance
Scalability
Others

Performance-related new features
New Resource Monitor options
Session state improvement
ApplicationProgramAutomatic Running
Response. redirectpermanent

Resource Monitoring
CPU and memory are limited resources
Traditional monitoring is at the process level
Unable to monitor an application domain
CLR 4 introduced "arm"
Application domain Resource Management
ARM-based performance counters
Managed memory used
% Managed processor time

Session state
Cross-process session state
Faster
Automatic Compression
Reduces network traffic to a large extent
Reduced to 1/3 to 2/3
Use commands to control session state on/off
Used only when actually needed
Local session state
Only sessions with the specified key are used to reduce network traffic.

Automatic application running
Improve website performance
Make individual webpages run faster
"Hide" startup costs for the first website application running
Hide startup through ASP. NET and IIS
Iis7.5 is capable of "self-starting" work processes and applications
ASP. NET 4 and iis7.5
You can set the following content in applicationhost. config to make the specified pool always warm up.
<Applicationpools>
<Add name = "myapplicationpool" startmode = "alwaysrunning"/>
</Applicationpools>

Automatic application running
IIS team creates a warm-up module
Run at the top of iis7.5 to provide the auto-start feature
Supports any ASP. NET version
Http://www.iis.net/extensions/ApplicationWarmUp

Response. redirectpermanent
Response. Redirect generates the HTTP 302 status code, which is a temporary redirect and will trigger two requests from the client to the web server.
Response. redirectpermanent generates the HTTP 301 status code, which is a permanent redirect. the browser or search engine will directly access the redirected address next time.

Scalability Improvement
Session state
Output Cache
Custom encoding for HTML, URL, HTML attribute, and HTTP headers
Request Validation

Session state extension
You can still use sessionstatestoreproviderbase to implement custom session storage.
The official team will provide a new session State provider

Expansion of output Cache
Use outputcacheprovider to derive a new class to implement custom output cache provider
The new output cache provider will be provided officially
Windows appfabric caching (distributed cache)
Output cache provider based on disk storage
Extended Mechanism support
Absolute expiration time
File dependency
Static replacement and Verification

Custom encoding Extension
Use System. Web. util. httpencoder to derive a new class for custom encoding.
And set it in Web. config.
<Httpruntime encodertype = "samples. mycustomencoder, samples"/>
The custom encoding logic is automatically called when the public methods of system. Web. httputility or system. Web. httpserverutility are called.

Extended request Validation
A new class is derived from system. Web. util. requestvalidator to implement custom requestvalidation.
And set it in Web. config.
<Httpruntime requestvalidationtype = "samples. myvalidator, samples"/>
Then, all requests of the website are checked using the custom logic.

Others
The httpruntime of Web. config allows you to set URL length, character restrictions, and other rules.
Maxrequestpathlength
Maxquerystringlength
Requestpathinvalidchars
Rewrite the URL using routetable. Routes

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.