0

We are in middle of upgrading our pre-production environment from 4.0 to 4.8 .net framework. After upgrade we are seeing following error as soon as you open the site,

enter image description here

Although this error can be fixed if we modify web.config file manually from,

  <dependentAssembly>
    <assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/>
    <bindingRedirect oldVersion="0.0.0.0-2.2.29.0" newVersion="2.2.29.0"/>
  </dependentAssembly>

To,

<dependentAssembly>
    <assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-2.2.29.0" newVersion="4.0.0.0" />
  </dependentAssembly>

What I am curious to know if we can avoid web.config updates and yet upgrade to 4.8 because this is going to be a nightmare for production upgrade for more than 1000 sites.

Please advise!

Ris
  • 1,152
  • 7
  • 29
  • 63
  • How are you upgrading, exactly? And how are you deploying afterwards? – CodeCaster Apr 12 '23 at 15:58
  • By changing our projects to point to new framework in project properties. Rest visual studio takes care of every other change. Deployment would be from master branch to production environment refresh. – Ris Apr 12 '23 at 16:05
  • Try reinstalling all NuGet packages after that, which will force the binding redirects to be regenerated: https://stackoverflow.com/questions/6876732/how-do-i-get-nuget-to-install-update-all-the-packages-in-the-packages-config – CodeCaster Apr 12 '23 at 16:08
  • Do you suggest to run Install-Package -Reinstall -All in production environment ? We are still going to keep 4.0 framework in our IIS. – Ris Apr 12 '23 at 16:10
  • But if you mean you have many sites whose web.config is sacred and must not be touched, then you have a whole nother problem which you must address immediately. After you've taken backup/deployment steps, then you could update them with a PowerShell RegRex script. – CodeCaster Apr 12 '23 at 16:11
  • No, not in production. After upgrading the framework, do `Update-Package -Reinstall` to fix the web.config. Then deploy the upgraded site with said config. – CodeCaster Apr 12 '23 at 16:11
  • I did run the command, and it generates in my development environment. However, my concern is more related to upgrading pre-prod/prod sites where web.config files doesnt upgrade from the master. If someone has to be change, it must happen manually. – Ris Apr 12 '23 at 16:17
  • 1
    That's what I meant by my earlier comment: that is problematic. What would you do if the server's disk crashed? What if you have another update that requires a new or changed config value? If you can't update your configs from your deployment system, you'll have to script the update. Some PowerShell (and rigorous testing and backups) should get you a long way. – CodeCaster Apr 12 '23 at 16:19
  • Its not me but added by stackoverflow – Ris Apr 12 '23 at 19:56

0 Answers0