ASP. NET 5 Beta8 release and upgrade experience, asp. netbeta8

Source: Internet
Author: User

ASP. NET 5 Beta8 release and upgrade experience, asp. netbeta8

(This article is also published in my public account "dotNET daily excellent article". Welcome to the QR code on the right to follow it .)

Question: ASP. NET 5 Beta8 was released on schedule, which is an important milestone because it is ASP.. NET 5 features frozen version, it is strongly recommended that you do not hesitate to use ASP. NET 5 in the production environment.

As a feature frozen version, there are many changes compared with Beta7.

The biggest change is to change the IIS hosting model.

Previously, the hosting method was "two ships on foot". In addition to the DNX host, there was also a host named "Helios" for IIS. This method brings about the complexity of development, maintenance and testing, and also makes the internal processes of program execution different. Currently, there is only one DNX host. If you want to run in IIS, you need to use a new HttpPlatformHandler to pass the request to the Kestrel server of ASP. NET 5.

If the extension of IIS is IISExpress, you can install the Web Tools update of Beta8. If not, you need to install it separately.

In addition, you need to add a web. config file to the wwwroot file for the old project. For details, refer to the link at the end of the article or use beta8 to create a new project.

The second is the features supported by localization.

When app. UseRequestLocalization (options) is used to enable localization, the built-in language judgment provider determines the current language based on the Request Header, query string, or cookie value. Then you can use services. AddLocalization (options => options. ResourcesPath = "resources"); to pass the localized string content.

Of course, MVC localization is also supported.

The DNX Watch command enables dynamic development.

Although. NET supports dynamic compilation. It must implement dynamic development like Ruby and Python (that is, after the code is modified or pushed in the production environment, the program runs in the latest version) you still need to do some extra work (or use a framework like WebPages ). Now in ASP. NET 5 provides the DNX Watch command to monitor changes to all files in the project, so as to achieve rapid development workflow: Edit code, save, and then refresh the browser to see updates ).

Installation Method: dnu commands install Microsoft. Dnx. Watcher

Execution method: dnx-watch web

In addition to the above enhancements, you can refer to beta8 release announcements and release notes.:

Http://blogs.msdn.com/ B /webdev/archive/2015/10/15/announcing-availability-of-asp-net-5-beta8.aspx

Https://github.com/aspnet/Home/releases/tag/v1.0.0-beta8

Upgrade beta8 from beta7

Of course, the entire beta8 has also brought about some destructive changes. I will give a brief introduction based on my experience in upgrading beta7:

  • TargetElementAttribute is renamed as HtmlTargetElementAttribute.
  • Use StringValues to replace string []. For example, the method used to access HttpContext. Request. Header is different.
  • UseErrorHandler and UseErrorPage extensions are renamed, that is, UseErrorHandler-> UseExceptionHandler, UseErrorPage-> useerrorexceptionpage
  • Controller. Context-> Controller. HttpContext
  • Openidconnectauthenticationults ults-> OpenIdConnectDefaults
  • Change the ActionExecutedContext namespace to Microsoft. AspNet. Mvc. Filters.
  • IOptions. Options-> IOptions. Value
  • IdentityOptions. EmailConfirmationTokenProvider-> IdentityOptions. Tokens. EmailConfirmationTokenProvider
  • The Controller provides attributes such as User and Request, and does not need to be indirectly accessed through HttpContext. It is similar to the Controller usage of MVC5.
  • IdentityServiceCollectionExtensions. ConfigureIdentity removal, configuration put into AddIdentity; ConfigureIdentityApplicationCookie removal, configuration through the cookie attribute configuration of IdentityOptions
  • MemoryConfigurationSource-> MemoryConfigurationProvider
  • The constructor of ConfigurationBuilder is adjusted and does not accept the basePath value. Instead, it must be as follows: var configurationBuilder = new ConfigurationBuilder (). SetBasePath (appEnv. ApplicationBasePath)

    More change records can be viewed here: https://github.com/aspnet/Announcements/issues? Q = is % 3 Aopen + is % 3 Aissue + milestone % 3A1. 0.0-beta8

  • Beta8 Web Tools download at: http://www.microsoft.com/en-us/download/details.aspx? Id = 49442

    Related Article

    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.