Configuration Error related to targetFramework in web.config

后端 未结 7 851
青春惊慌失措
青春惊慌失措 2021-02-02 06:54

I have made an MVC website in Visual Studio 2015 and it works in my localhost. But when I published my website and put into my host, it doesn\'t work. It gives me this error not

相关标签:
7条回答
  • 2021-02-02 07:27

    Your website project is targeting v4.6 of the .Net Framework but your hosting provider has not yet installed this version. Your options:

    1. Ask provider to install it - they are unlikely to do this.
    2. Find another provider that does support it.
    3. Change your project to target v4.5.
    0 讨论(0)
  • 2021-02-02 07:27

    had the same issue on the below line on an offline server ,

     <compilation targetFramework="4.5.2">
    

    tried adding all the roles and features related to .Net framework from the server manager and to its pool ,

    but didn't work , what worked for me is just downloading Microsoft .NET Framework 4.5.2(Offline Installer)

    0 讨论(0)
  • 2021-02-02 07:28

    @DavidG has rightly pointed all the things. Just on informational side if IIS is your provider then Web Platform Installer is your best bet to check the current state of what all is installed on your machine currently. Have a look at the below snapshot -

    It is really handy to check what all is missing and you can kick-start installation of all the missing pieces in one click.

    0 讨论(0)
  • 2021-02-02 07:30

    I just had a similar problem following the installation ( windows update) of the KB 3205402.

    Big difference with my case: the application worked well before the update !

    ==> I found in "IIS Manager", in "ISAPI and CGI Restrictions", that the framework ASP.NET v4.0.30319 has been switched to "unauthorized" !

    Switching it to "Authorized" resolved my problem

    0 讨论(0)
  • 2021-02-02 07:37

    I changed:

    <system.web>
        <compilation debug="true" targetFramework="4.7" />
        <httpRuntime targetFramework="4.7" />
        <customErrors mode="Off"/>
      </system.web>
    

    to

    <system.web>
         <compilation debug="true" targetFramework="4.5" />
         <httpRuntime targetFramework="4.5" />
         <customErrors mode="Off"/>
    </system.web>
    

    i.e, changed targetFramework value to 4.5 (the one supported on server) from 4.7. and worked.

    0 讨论(0)
  • 2021-02-02 07:39

    I went round and round with this today with no resolution. Exasperated, I finally just deleted my working copy from my drive, and rechecked it out from SVN.

    Fixed.

    Not a particularly clever answer, but it fixed it for me, no idea what the actual problem was.

    0 讨论(0)
提交回复
热议问题