Ext. net mvc configuration problem summary

Source: Internet
Author: User

With the VS version and. the net mvc version and EF version are constantly updated. Although many functions are improved with the upgrade of the version, it is a little sad for the software developed in the old version, many developers may encounter similar problems!

A recent project is used. NET MVC3 + EXT. net mvc development (I used Ext. net MVC configuration (2) for configuration). Now we need to port it to the MVC4 environment, and we have encountered various problems, all of which are quickly broken. Now let's summarize:

1. ASP. NET Web Pages version Problems

After debugging, the browser prompts:

Detected conflicting ASP. NET Web Pages versions: the specified version is 1.0.0.0, And the bin version is 2.0.0.0 ". To continue, delete the files in the bin directory of the application or delete the version specified in web. config.

 

Solution:

Configure Web. config under the project

<Deleetask>
<Add key = "webpages: Version"/>
<Add key = "ClientValidationEnabled" value = "true"/>
<Add key = "UnobtrusiveJavaScriptEnabled" value = "true"/>
</AppSettings>

 

2. System. Web. WebPages. Razor. Configuration. HostSection version

After debugging, the browser prompts:

[A] System. Web. WebPages. Razor. Configuration. HostSection cannot be forcibly converted to [B] System. Web. WebPages. Razor. Configuration. HostSection. Type A is derived from "System. web. webPages. razor, Version = 1.0.0.0, Culture = neutral, PublicKeyToken = 31bf3856ad364e35 "(in the Context" Default "," C: \ Windows \ Microsoft. net \ assembly \ GAC_MSIL \ System. web. webPages. razor \ v4.0 _ 1.0.0.0 _ 31bf3856ad364e35 \ System. web. webPages. razor. dll ). Type B is derived from "System. web. webPages. razor, Version = 2.0.0.0, Culture = neutral, PublicKeyToken = 31bf3856ad364e35 "(in the Context" Default "," C: \ Windows \ Microsoft. net \ assembly \ GAC_MSIL \ System. web. webPages. razor \ v4.0 _ 2.0.0.0 _ 31bf3856ad364e35 \ System. web. webPages. razor. dll ).

Solution:

Configure Web. config in view

<Section name = "host" type = "System. web. webPages. razor. configuration. hostSection, System. web. webPages. razor, Culture = neutral, PublicKeyToken = 31BF3856AD364E35 "requirePermission =" false "/>

 

3. System. Web. WebPages. Razor. Configuration. RazorPagesSection

Version Problems

After debugging, the browser prompts:

[A] System. Web. WebPages. Razor. Configuration. RazorPagesSection cannot be forcibly converted to [B] System. Web. WebPages. Razor. Configuration. RazorPagesSection. Type A is derived from "System. web. webPages. razor, Version = 1.0.0.0, Culture = neutral, PublicKeyToken = 31bf3856ad364e35 "(in the Context" Default "," C: \ Windows \ Microsoft. net \ assembly \ GAC_MSIL \ System. web. webPages. razor \ v4.0 _ 1.0.0.0 _ 31bf3856ad364e35 \ System. web. webPages. razor. dll ). Type B is derived from "System. web. webPages. razor, Version = 2.0.0.0, Culture = neutral, PublicKeyToken = 31bf3856ad364e35 "(in the Context" Default "," C: \ Windows \ Microsoft. net \ assembly \ GAC_MSIL \ System. web. webPages. razor \ v4.0 _ 2.0.0.0 _ 31bf3856ad364e35 \ System. web. webPages. razor. dll ).

Solution:

Configure Web. config in view

<Section name = "pages" type = "System. web. webPages. razor. configuration. razorPagesSection, System. web. webPages. razor, Culture = neutral, PublicKeyToken = 31BF3856AD364E35 "requirePermission =" false "/>

 

4,System. Web. Mvc. MvcWebRazorHostFactory

Version Problems

The expression "System. Web. Mvc. MvcWebRazorHostFactory" cannot be used to return the type "System. Web. WebPages. Razor. WebRazorHostFactory"

Solution:

Configure Web. config under the project

<Runtime>
<AssemblyBinding xmlns = "urn: schemas-microsoft-com: asm. v1">
















</AssemblyBinding>

</Runtime>

Note: The Blue is the original configuration, and the red section will not report the above error!

For the above version issue, you only need to change the configuration of the red part to the number of corresponding DLL versions in the binfile.

The above problem is the error that occurs when the mvc3 configuration is transplanted to mvc4. With the advent of VS2013 and mvc5, more problems may occur, and more problems may occur in the future.

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.