c# - MVC5 Razor View always show the error: "the type arguments cannot be inferred from usage" -
i've updated project mvc4 mvc5 , since i'm getting error message though runs perfectly
this web.config file:
<?xml version="1.0" encoding="utf-8"?>
<configsections> <section name="loggingconfiguration" type="microsoft.practices.enterpriselibrary.logging.configuration.loggingsettings, microsoft.practices.enterpriselibrary.logging, version=6.0.0.0, culture=neutral, publickeytoken=31bf3856ad364e35" requirepermission="true" /> <section name="exceptionhandling" type="microsoft.practices.enterpriselibrary.exceptionhandling.configuration.exceptionhandlingsettings, microsoft.practices.enterpriselibrary.exceptionhandling, version=6.0.0.0, culture=neutral, publickeytoken=31bf3856ad364e35" requirepermission="true" /> <section name="entityframework" type="system.data.entity.internal.configfile.entityframeworksection, entityframework, version=6.0.0.0, culture=neutral, publickeytoken=b77a5c561934e089" requirepermission="false" /> <sectiongroup name="bundletransformer"> <section name="core" type="bundletransformer.core.configuration.coresettings, bundletransformer.core" /> <section name="less" type="bundletransformer.less.configuration.lesssettings, bundletransformer.less" /> <section name="yui" type="bundletransformer.yui.configuration.yuisettings, bundletransformer.yui" /> </sectiongroup> <sectiongroup name="jsengineswitcher"> <section name="core" type="javascriptengineswitcher.core.configuration.coreconfiguration, javascriptengineswitcher.core" /> <section name="msie" type="javascriptengineswitcher.msie.configuration.msieconfiguration, javascriptengineswitcher.msie" /> </sectiongroup> </configsections> <loggingconfiguration name="" tracingenabled="true" defaultcategory="error"> <listeners> <add name="rolling flat file trace listener" type="microsoft.practices.enterpriselibrary.logging.tracelisteners.rollingflatfiletracelistener, microsoft.practices.enterpriselibrary.logging, version=6.0.0.0, culture=neutral, publickeytoken=31bf3856ad364e35" listenerdatatype="microsoft.practices.enterpriselibrary.logging.configuration.rollingflatfiletracelistenerdata, microsoft.practices.enterpriselibrary.logging, version=6.0.0.0, culture=neutral, publickeytoken=31bf3856ad364e35" filename="sgew.log" formatter="text formatter" rollfileexistsbehavior="increment" rollsizekb="102400" maxarchivedfiles="10" /> </listeners> <formatters> <add type="microsoft.practices.enterpriselibrary.logging.formatters.textformatter, microsoft.practices.enterpriselibrary.logging, version=6.0.0.0, culture=neutral, publickeytoken=31bf3856ad364e35" template="timestamp: {timestamp(local)}{newline}
message: {message}{newline}
category: {category}{newline}
priority: {priority}{newline}
eventid: {eventid}{newline}
severity: {severity}{newline}
title:{title}{newline}
machine: {localmachine}{newline}
app domain: {localappdomain}{newline}
processid: {localprocessid}{newline}
process name: {localprocessname}{newline}
thread name: {threadname}{newline}
win32 threadid:{win32threadid}{newline}
extended properties: {dictionary({key} - {value}{newline})}" name="text formatter" /> </formatters> <categorysources> <add switchvalue="all" name="error"> <listeners> <add name="rolling flat file trace listener" /> </listeners> </add> </categorysources> <specialsources> <allevents switchvalue="all" name="all events" /> <notprocessed switchvalue="all" name="unprocessed category" /> <errors switchvalue="all" name="logging errors & warnings"> <listeners> <add name="rolling flat file trace listener" /> </listeners> </errors> </specialsources> </loggingconfiguration> <exceptionhandling> <exceptionpolicies> <add name="errorpolicy"> <exceptiontypes> <add name="exception" type="system.exception, mscorlib, version=4.0.0.0, culture=neutral, publickeytoken=b77a5c561934e089" posthandlingaction="thrownewexception"> <exceptionhandlers> <add name="wrap handler" type="microsoft.practices.enterpriselibrary.exceptionhandling.wraphandler, microsoft.practices.enterpriselibrary.exceptionhandling, version=6.0.0.0, culture=neutral, publickeytoken=31bf3856ad364e35" exceptionmessage="erro da aplicação" wrapexceptiontype="system.exception, mscorlib, version=4.0.0.0, culture=neutral, publickeytoken=b77a5c561934e089" /> </exceptionhandlers> </add> </exceptiontypes> </add> </exceptionpolicies> </exceptionhandling> <appsettings> <add key="vs:enablebrowserlink" value="false" /> <add key="webpages:version" value="3.0.0.0" /> <add key="webpages:enabled" value="false" /> <add key="preserveloginurl" value="true" /> <add key="clientvalidationenabled" value="true" /> <add key="unobtrusivejavascriptenabled" value="true" /> <add key="mvcsitemapprovider_enablesitemapsxml" value="false" /> <add key="mvcsitemapprovider_useexternaldicontainer" value="true" /> <add key="mvcsitemapprovider_scanassembliesforsitemapnodes" value="true" /> <add key="mvcsitemapprovider_includeassembliesforscan" value="aspnetmvcapplication" /> </appsettings> <connectionstrings> <add name="sgewcontext" connectionstring="data source=myconnectionstring" providername="system.data.sqlclient" /> <add name="tenantcontext" connectionstring="data source=myconnectionstring" providername="system.data.sqlclient" /> </connectionstrings> <system.web> <customerrors mode="off" /> <httpruntime targetframework="4.5"/> <compilation debug="true" targetframework="4.5" /> <pages controlrenderingcompatibilityversion="4.0"> <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="mvcsitemapprovider.web.html" /> <add namespace="mvcsitemapprovider.web.html.models" /> </namespaces> </pages> <sessionstate mode="stateserver" timeout="5" /> <httpmodules> <add name="oneperrequestmodule" type="ninject.oneperrequestmodule" /> </httpmodules> <authentication mode="forms"> <forms name="sgew" loginurl="~/login" timeout="60" /> </authentication> <caching> <outputcachesettings> <outputcacheprofiles> <!-- mantem o cache das views que usarem esse perfil. valor em segundos. --> <add name="cacheprincipal" duration="1" varybyparam="none" /> <!-- mantem o cache das views que usarem esse perfil. valor em segundos. --> <add name="cachesecundario" duration="1" varybyparam="tiposelecao;tipoentidade" /> </outputcacheprofiles> </outputcachesettings> </caching> </system.web> <system.webserver> <validation validateintegratedmodeconfiguration="false" /> <modules> <remove name="rolemanager" /> <remove name="urlroutingmodule-4.0" /> <add name="urlroutingmodule-4.0" type="system.web.routing.urlroutingmodule" /> </modules> <handlers> <add name="lessassethandler" path="*.less" verb="get" type="bundletransformer.less.httphandlers.lessassethandler, bundletransformer.less" resourcetype="file" precondition="" /> </handlers> <security> <requestfiltering> <hiddensegments> <add segment="clearscript.v8" /> </hiddensegments> </requestfiltering> </security> <staticcontent> <remove fileextension=".woff2" /> <mimemap fileextension=".woff2" mimetype="application/font-woff2" /> </staticcontent> </system.webserver> <system.servicemodel> <bindings> <basichttpbinding> <binding name="basichttpbinding_iwcfcepservice" /> </basichttpbinding> </bindings> <client> <endpoint address="http://srvdsnv/wcfcep/wcfcepservice.svc" binding="basichttpbinding" bindingconfiguration="basichttpbinding_iwcfcepservice" contract="cepservice.iwcfcepservice" name="basichttpbinding_iwcfcepservice" /> </client> </system.servicemodel> <entityframework> <defaultconnectionfactory type="system.data.entity.infrastructure.sqlconnectionfactory, entityframework" /> <providers> <provider invariantname="system.data.sqlclient" type="system.data.entity.sqlserver.sqlproviderservices, entityframework.sqlserver" /> </providers> </entityframework> <bundletransformer xmlns="http://tempuri.org/bundletransformer.configuration.xsd"> <less> <jsengine name="msiejsengine" /> </less> <core> <assethandler disableclientcache="true" disableservercache="true" servercachedurationinminutes="15" /> <css> <minifiers> <add name="nullminifier" type="bundletransformer.core.minifiers.nullminifier, bundletransformer.core" /> <add name="yuicssminifier" type="bundletransformer.yui.minifiers.yuicssminifier, bundletransformer.yui" /> </minifiers> <translators> <add name="nulltranslator" type="bundletransformer.core.translators.nulltranslator, bundletransformer.core" enabled="false" /> <add name="lesstranslator" type="bundletransformer.less.translators.lesstranslator, bundletransformer.less" /> </translators> <fileextensions> <add fileextension=".css" assettypecode="css" /> <add fileextension=".less" assettypecode="less" /> </fileextensions> <postprocessors> <add name="urlrewritingcsspostprocessor" type="bundletransformer.core.postprocessors.urlrewritingcsspostprocessor, bundletransformer.core" useindebugmode="false" /> </postprocessors> </css> <js> <minifiers> <add name="nullminifier" type="bundletransformer.core.minifiers.nullminifier, bundletransformer.core" /> <add name="yuijsminifier" type="bundletransformer.yui.minifiers.yuijsminifier, bundletransformer.yui" /> </minifiers> <translators> <add name="nulltranslator" type="bundletransformer.core.translators.nulltranslator, bundletransformer.core" enabled="false" /> </translators> <fileextensions> <add fileextension=".js" assettypecode="javascript" /> </fileextensions> </js> </core> </bundletransformer> <jsengineswitcher xmlns="http://tempuri.org/javascriptengineswitcher.configuration.xsd"> <core> <engines> <add name="msiejsengine" type="javascriptengineswitcher.msie.msiejsengine, javascriptengineswitcher.msie" /> <add name="v8jsengine" type="javascriptengineswitcher.v8.v8jsengine, javascriptengineswitcher.v8" /> </engines> </core> </jsengineswitcher> <runtime> <assemblybinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentassembly> <assemblyidentity name="bundletransformer.core" publickeytoken="973c344c93aac60d" culture="neutral" /> <bindingredirect oldversion="0.0.0.0-1.9.25.0" newversion="1.9.25.0" /> </dependentassembly> <dependentassembly> <assemblyidentity name="system.web" publickeytoken="b03f5f7f11d50a3a" culture="neutral" /> <bindingredirect oldversion="0.0.0.0-4.0.0.0" newversion="4.0.0.0" /> </dependentassembly> <dependentassembly> <assemblyidentity name="system.data" publickeytoken="b77a5c561934e089" culture="neutral" /> <bindingredirect oldversion="0.0.0.0-4.0.0.0" newversion="4.0.0.0" /> </dependentassembly> <dependentassembly> <assemblyidentity name="webgrease" publickeytoken="31bf3856ad364e35" culture="neutral" /> <bindingredirect oldversion="0.0.0.0-1.6.5135.21930" newversion="1.6.5135.21930" /> </dependentassembly> <dependentassembly> <assemblyidentity name="system.web.optimization" publickeytoken="31bf3856ad364e35" culture="neutral" /> <bindingredirect oldversion="0.0.0.0-1.1.0.0" newversion="1.1.0.0" /> </dependentassembly> <dependentassembly> <assemblyidentity name="newtonsoft.json" publickeytoken="30ad4fe6b2a6aeed" culture="neutral" /> <bindingredirect oldversion="0.0.0.0-6.0.0.0" newversion="6.0.0.0" /> </dependentassembly> <dependentassembly> <assemblyidentity name="system.net.http.formatting" publickeytoken="31bf3856ad364e35" culture="neutral" /> <bindingredirect oldversion="0.0.0.0-5.2.2.0" newversion="5.2.2.0" /> </dependentassembly> <dependentassembly> <assemblyidentity name="system.web.webpages.razor" publickeytoken="31bf3856ad364e35" culture="neutral" /> <bindingredirect oldversion="0.0.0.0-3.0.0.0" newversion="3.0.0.0" /> </dependentassembly> <dependentassembly> <assemblyidentity name="system.web.razor" publickeytoken="31bf3856ad364e35" culture="neutral" /> <bindingredirect oldversion="0.0.0.0-3.0.0.0" newversion="3.0.0.0" /> </dependentassembly> <dependentassembly> <assemblyidentity name="dotnetopenauth.aspnet" publickeytoken="2780ccd10d57b246" culture="neutral" /> <bindingredirect oldversion="0.0.0.0-4.1.0.0" newversion="4.1.0.0" /> </dependentassembly> <dependentassembly> <assemblyidentity name="dotnetopenauth.core" publickeytoken="2780ccd10d57b246" culture="neutral" /> <bindingredirect oldversion="0.0.0.0-4.1.0.0" newversion="4.1.0.0" /> </dependentassembly> <dependentassembly> <assemblyidentity name="system.web.http" publickeytoken="31bf3856ad364e35" culture="neutral" /> <bindingredirect oldversion="0.0.0.0-5.0.0.0" newversion="5.0.0.0" /> </dependentassembly> <dependentassembly> <assemblyidentity name="antlr3.runtime" publickeytoken="eb42632606e9261f" culture="neutral" /> <bindingredirect oldversion="0.0.0.0-3.5.0.2" newversion="3.5.0.2" /> </dependentassembly> <dependentassembly> <assemblyidentity name="castle.core" publickeytoken="407dd0808d44fbdc" culture="neutral" /> <bindingredirect oldversion="0.0.0.0-3.3.0.0" newversion="3.3.0.0" /> </dependentassembly> <dependentassembly> <assemblyidentity name="system.web.helpers" publickeytoken="31bf3856ad364e35" /> <bindingredirect oldversion="1.0.0.0-3.0.0.0" newversion="3.0.0.0" /> </dependentassembly> <dependentassembly> <assemblyidentity name="system.web.webpages" publickeytoken="31bf3856ad364e35" /> <bindingredirect oldversion="0.0.0.0-3.0.0.0" newversion="3.0.0.0" /> </dependentassembly> <dependentassembly> <assemblyidentity name="system.web.mvc" publickeytoken="31bf3856ad364e35" /> <bindingredirect oldversion="0.0.0.0-5.2.2.0" newversion="5.2.2.0" /> </dependentassembly> <dependentassembly> <assemblyidentity name="javascriptengineswitcher.core" publickeytoken="c608b2a8cc9e4472" culture="neutral" /> <bindingredirect oldversion="0.0.0.0-1.2.0.0" newversion="1.2.0.0" /> </dependentassembly> <dependentassembly> <assemblyidentity name="msiejavascriptengine" publickeytoken="a3a2846a37ac0d3e" culture="neutral" /> <bindingredirect oldversion="0.0.0.0-1.5.0.0" newversion="1.5.0.0" /> </dependentassembly> </assemblybinding> </runtime>
i'm looking answer since last week , can't find 1 :/
i have checked assemblies , update nuget packages doesn't seen help.
as saw in post, i've set red line doesn't disappear.
i had same problem when installed razorengine package manager console. after deleting part of web.config, project working again. let's hope fix too.
my web.config then
<assemblybinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentassembly> <assemblyidentity name="webgrease" publickeytoken="31bf3856ad364e35" culture="neutral" /> <bindingredirect oldversion="0.0.0.0-1.5.2.14234" newversion="1.5.2.14234" /> </dependentassembly> <dependentassembly> <assemblyidentity name="newtonsoft.json" publickeytoken="30ad4fe6b2a6aeed" culture="neutral" /> <bindingredirect oldversion="0.0.0.0-6.0.0.0" newversion="6.0.0.0" /> </dependentassembly> <dependentassembly> <assemblyidentity name="system.web.http" publickeytoken="31bf3856ad364e35" culture="neutral" /> <bindingredirect oldversion="0.0.0.0-5.2.2.0" newversion="5.2.2.0" /> </dependentassembly> <dependentassembly> <assemblyidentity name="system.net.http.formatting" publickeytoken="31bf3856ad364e35" culture="neutral" /> <bindingredirect oldversion="0.0.0.0-5.2.2.0" newversion="5.2.2.0" /> </dependentassembly> <dependentassembly> <assemblyidentity name="system.web.mvc" publickeytoken="31bf3856ad364e35" culture="neutral" /> <bindingredirect oldversion="0.0.0.0-4.0.0.0" newversion="4.0.0.0" /> </dependentassembly> <dependentassembly> <assemblyidentity name="system.web.razor" publickeytoken="31bf3856ad364e35" culture="neutral" /> <bindingredirect oldversion="0.0.0.0-3.0.0.0" newversion="3.0.0.0" /> </dependentassembly> </assemblybinding>
so had remove part
<dependentassembly> <assemblyidentity name="system.web.razor" publickeytoken="31bf3856ad364e35" culture="neutral" /> <bindingredirect oldversion="0.0.0.0-3.0.0.0" newversion="3.0.0.0" /> </dependentassembly>
Comments
Post a Comment