ASP.NET Website Project builds, but publishing errors

We have a .NET 4 website project created using Visual Studio 2013 that references the System.Net.Http.dll file.

This is the line in the web.config file that loads the .dll:

<add assembly="System.Net.Http, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/> 

The project builds great, but when we try to "Publish a website", it gives the following error:

The type or namespace name "Http" does not exist in the namespace 'System.Net (do you miss the assembly reference?)

It seems that the assembly can be loaded from the GAC, we tried to put the assembly in the application's BIN folder, but that doesn’t matter - it still appears as a GAC ​​link on the project’s property pages.

We also tried to add:

 <runtime> <assemblyBinding> <dependentAssembly> <assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/> <codeBase version="1.0.0.0" href="/bin/System.Net.Http.dll"/> </dependentAssembly> </assemblyBinding> 

As suggested here: Failed to load file or assembly System.Web.Http.WebHost after posting on Azure website

But that doesn't work either.

We changed the Target Framework to 3.5 and 4.5 with no effect.

We tried to publish several different machines.

EDIT: we tried to offer the nuget package in RobAda, and it did not get the desired effect, we still get errors.

+7
c # visual-studio-2013 publish
source share
2 answers

It sounds like you are trying to teach something where it does not fit / not fit.

One possible architectural approach would be to divide functionality into a solution.

If time constraints are a problem, and it is possible, this may be the solution to your problems.

Long-term: you need to be sure that you will keep track of time, since you will receive more of these problems, as time moves on, of course, this should be a pragmatic approach ...

+1
source share

I saw the same problem in the application for friends, we had to dig quite a bit, but in the end it turned out that you need to install this nuget package:

https://www.nuget.org/packages/Microsoft.Net.Http

Then you will need to add a link to System.Net.Http so that it does not produce a reported error.

+4
source share

All Articles