c# - The expression of type 'System.Web.Mvc.MvcWebRazorHostFactory' can not be used for return type 'System.Web.WebPages.Razor.WebRazorHostFactory' -
i have website developed in mvc 3, , trying open visual studio 2012, updates project , seek run project, gives error:
the look of type 'system.web.mvc.mvcwebrazorhostfactory' can not used homecoming type 'system.web.webpages.razor.webrazorhostfactory'
system.web.mvc updated dll version 4.0.0.1.
web.config<?xml version="1.0"?> <!-- more info on how configure asp.net application, please visit http://go.microsoft.com/fwlink/?linkid=152368 --> <configuration> <connectionstrings> <add name="main" connectionstring="data source=sacteste;persist security info=true;user id=automa;password=auto2020;unicode=true" providername="system.data.oracleclient"/> </connectionstrings> <appsettings> <add key="webpages:version" value="1.0.0.0"/> <add key="clientvalidationenabled" value="true"/> <add key="unobtrusivejavascriptenabled" value="true"/> <add key="assuntoemailnotas" value="nota financial emitida"/> <add key="templateemailnotas" value="c:\dotnet\pif\gestaonfse\templatenfse.cshtml"/> <add key="templateemailcobranca" value="c:\dotnet\pif\gestaonfse\templatecartacobranca.cshtml"/> <add key="emailfromendereco" value="desenvolvimento@megasul.com.br"/> <add key="emailfromnome" value="megasul"/> <add key="chavecriptografia" value="_nfse_megasul#1234"/> <!-- alterar chave invalida todos os e-mails já enviados! --> <add key="diretoriolicencascobrebem" value="c:\cobrebemx\"/> <add key="enablesimplemembership" value="false"/> <add key="autoformsauthentication" value="false"/> </appsettings> <system.web> <compilation debug="true" targetframework="4.0"> <assemblies> <add assembly="system.web.abstractions, version=4.0.0.0, culture=neutral, publickeytoken=31bf3856ad364e35"/> <add assembly="system.web.helpers, version=1.0.0.0, culture=neutral, publickeytoken=31bf3856ad364e35"/> <add assembly="system.web.routing, version=4.0.0.0, culture=neutral, publickeytoken=31bf3856ad364e35"/> <add assembly="system.web.mvc, version=4.0.0.0, culture=neutral, publickeytoken=31bf3856ad364e35"/> <add assembly="system.web.webpages, version=2.0.0.0, culture=neutral, publickeytoken=31bf3856ad364e35"/> </assemblies> </compilation> <authentication mode="forms"> <forms loginurl="~/account/logon" timeout="2880"/> </authentication> <membership defaultprovider="megamembershipprovider"> <providers> <clear/> <add name="megamembershipprovider" applicationname="webrat" type="megacontrols.membership.megamembershipprovider" connectionstringname="main" enablepasswordretrieval="true" enablepasswordreset="true" requiresquestionandanswer="false" minrequirednonalphanumericcharacters="0" maxinvalidpasswordattempts="10" minrequiredpasswordlength="1" writeexceptionstoeventlog="false" passwordformat="clear"/> <!--119746--> </providers> </membership> <profile> <providers> <clear/> <add name="aspnetsqlprofileprovider" type="system.web.profile.sqlprofileprovider" connectionstringname="applicationservices" applicationname="/"/> </providers> </profile> <rolemanager enabled="false"> <providers> <clear/> <add name="aspnetsqlroleprovider" type="system.web.security.sqlroleprovider" connectionstringname="applicationservices" applicationname="/"/> <add name="aspnetwindowstokenroleprovider" type="system.web.security.windowstokenroleprovider" applicationname="/"/> </providers> </rolemanager> <pages> <namespaces> <add namespace="system.web.helpers"/> <add namespace="system.web.mvc"/> <add namespace="system.web.mvc.ajax"/> <add namespace="system.web.mvc.html"/> <add namespace="system.web.routing"/> <add namespace="system.web.webpages"/> </namespaces> </pages> <customerrors mode="off"/> </system.web> <system.webserver> <validation validateintegratedmodeconfiguration="false"/> <modules runallmanagedmodulesforallrequests="true"/> </system.webserver> <system.net> <mailsettings> <smtp deliverymethod="network"> <network host="192.168.0.201" defaultcredentials="false" username="jani" password="jani"></network> </smtp> </mailsettings> </system.net> <runtime> <assemblybinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentassembly> <assemblyidentity name="system.web.mvc" publickeytoken="31bf3856ad364e35"/> <bindingredirect oldversion="1.0.0.0-3.0.0.1" newversion="4.0.0.1"/> </dependentassembly> </assemblybinding> </runtime> </configuration>
open web.config file located in views folder , alter factorytype version 5.0.0.0 of oct 26, 2015.
i.e
from
<host factorytype="system.web.mvc.mvcwebrazorhostfactory, system.web.mvc, version=4.0.0.0, culture=neutral, publickeytoken=31bf3856ad364e35" />
to
<host factorytype="system.web.mvc.mvcwebrazorhostfactory, system.web.mvc, version=5.0.0.0, culture=neutral, publickeytoken=31bf3856ad364e35" />
c# asp.net asp.net-mvc asp.net-mvc-4 razor
No comments:
Post a Comment