asp.net - Having an issue with IController when converting from MVC 3 to MVC4 -
i in process of converting web app mvc3 mvc4 client. far, have used this previous stackoverflow , these official steps during conversion process. note step 4 within official steps, not able update mvc4 using nuget. instead, had download mvc4 microsoft download center.
my issue when run web app (after "converting" mvc4) error:
the type name or alias icontroller not resolved. please check configuration file , verify type name.
i know icontroller located in system.web.mvc not sure why project cannot find it. tried replicating solution adding both assembly , namespace tags icontroller, didn't work. did remove old references mvc, helpers, , webpages , replaced them new references.
below code within web.config file. note used ellipses when skipping on unrelated code.
web.config (snippets)
<appsettings> <add key="webpages:version" value="2.0.0.0" /> <add key="preserveloginurl" value="true" /> <add key="clientvalidationenabled" value="true" /> <add key="unobtrusivejavascriptenabled" value="true" /> </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=2.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> ... <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" /> <add namespace="telerik.web.mvc" /> <add namespace="telerik.web.mvc.ui" /> <add namespace="infrastructure.mvc.extensions" /> </namespaces> </pages> </system.web> ... <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.0" newversion="3.0.0.1" /> </dependentassembly> </assemblybinding> </runtime> <unity> <!-- controllers --> <alias alias="icontroller" type="system.web.mvc.icontroller,system.web.mvc" /> ... <containers> <container> <!-- controllers --> <register type="icontroller" mapto="transactioncontroller" name="transaction" /> <register type="icontroller" mapto="actioncontroller" name="action" /> <register type="icontroller" mapto="taskcontroller" name="task" /> </container> </containers>
the error comes invalidoperationexception thrown in following code:
public class mvcapplication : system.web.httpapplication { ... private void configurecontainer() { var unitycontainer = new unitycontainer(); var unityconfigsection = configurationmanager.getsection("unity") unityconfigurationsection; unityconfigsection.configure(unitycontainer); // exception thrown right here controllerbuilder.current.setcontrollerfactory(new unitycontrollerfactory(unitycontainer)); }
also, within web.config file, replaced existing runtime tag 1 mentioned in step 7 of official conversion guide (link in beginning paragraph), didn't well.
Comments
Post a Comment