I get this error message on my server:
Method 'GetVirtualPath' in type 'System.Web.Http.WebHost.Routing.HostedHttpRoute' from assembly 'System.Web.Http.WebHost, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' does not have an implementation.
RouteTable.Routes.MapHttpRoute(...)
I use Nuget to download the latest nightly build of Microsoft ASP.NET Web Api.
It's seems like a bin/gac problem but I'm not sure.
An older version of System.Web.Http was installed in the GAC.
gacutil /uf system.web.http
That fixed it.
Related
In the BizTalk Console Administration I often see exceptions like the following:
There was a failure executing the response(receive) pipeline: "[pipelineName], [BizTalk projectName], Version=1.0.0.0, Culture=neutral, PublicKeyToken=35805574d24305bf" Source: "Unknown " Send Port: "[sendPortName]" URI: "[sqlServerConnString]" Reason: Failed to get pipeline: [pipelineName], [BizTalk projectName], Version=1.0.0.0, Culture=neutral, PublicKeyToken=35805574d24305bf. Please verify that the pipeline strong name is correct and that the pipeline assembly is in the GAC.
I think the problem is how I deployed the pipeline and the project because I have developed my solution on a Virtual Machine (that have Visual Studio) and then I deployed my solution on another Virtual Machine (that does not have Visual Studio installed).
For the deploy I put the dll needed in a folder and then I added them from BizTalk Administration tool (Resources). Another strange thing I noticed is that in Resources I have:
[pipelineName], Version=1.0.0.0, Culture=netrual, PublicKeyToken=60cf10bb1a125a7
[BizTalk projectName], Version=1.0.0.0, Culture=netrual, PublicKeyToken=35805574d24305bf
I have no idea how to solve this issue. Can you help me?
Please check:
pipelineName is a pipeline inside the project (and the DLL)
[BizTalk projectName], Version=1.0.0.0, Culture=netrual, PublicKeyToken=35805574d24305bf
Your DLL have to be in the GAC, please check that the DLL is in the GAC, If not, add the DLL from BizTalk Administration tool (Resources) with "Add to the global assembly cache on add resource (gacutil)" option checked.
On resources you only need this:
[BizTalk projectName], Version=1.0.0.0, Culture=netrual, PublicKeyToken=35805574d24305bf
The other one ([pipelineName], Version=1.0.0.0, Culture=netrual, PublicKeyToken=60cf10bb1a125a7) is another DLL that you added to this BizTalk application.
You have to properly deploy the Pipeline Component Assembly.
This article explains the entire process: BizTalk Server: Deploying Custom Pipeline Components in BizTalk Server 2006 and Higher
I had to restart the associated hosts and the standard BizTalkServerApplication host to refresh the in-memory data.
I have a .Net application which has target framework of 3.5
While debugging the code , i am facing the below error.
The primary reference "xxx" could not be resolved because it has an
indirect dependency on the .NET Framework assembly "mscorlib,
Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
which has a higher version "4.0.0.0" than the version "2.0.0.0" in the
current target framework.
I am running the application on VS2017.
How to rectify the error.
I have Build Definition
.NET Core Restore
.Net Core Build
.Net Core Test
.Net Core Publish
Publish Artefact
While I was using Core1.1 it worked without any issue. But after upgrading project to Core2.0 it fails with multiple errors like
error CS1703: Multiple assemblies with equivalent identity have been imported: 'C:\Users\buildguest\.nuget\packages\microsoft.netcore.app\2.0.0\ref\netcoreapp2.0\System.Threading.Tasks.Parallel.dll' and 'C:\Users\buildguest\.nuget\packages\system.threading.tasks.parallel\4.3.0\ref\netstandard1.1\System.Threading.Tasks.Parallel.dll'
error CS0433: The type 'TargetFrameworkAttribute' exists in both 'System.Runtime, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' and 'System.Runtime, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
error CS0518: Predefined type 'System.String' is not defined or imported
Solution is perfectly building locally. I tried to add task Use .NET Core runtime 2.0.0 in the beginning but without any success.
You should add .NET Core Tool Installer task at the beginning of the build steps. Then install the SDK not only runtime. Then save your build definition and queue again.
I have a Web API I created in ASP 5 MVC 6 (FULL CLR). The web API references a standard .net class library, which has the entity framework 6 NUGET package installed. If I launch the web api locally (IIS express) and then try to run a method which contacts the database, everything works fine.
When I deploy the web API (I set it up in IIS), using the "Publish" command, to my DEV server (Windows Server 2012) and try to contact the same method, but on the server, I get the following exception (any other method that doesn't touch the database works):
{
"$id":"1",
"ClassName":"System.IO.FileNotFoundException",
"Message":"Could not load file or assembly 'EntityFramework,
Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
or one of its dependencies. The system cannot find the file specified.",
"Data":null,
"InnerException":null,
"HelpURL":null,
"StackTraceString":"
at CMAllocation.Web.Data.InvestorRulesRepository..ctor()\r\n
at CMAllocation.Web.CMAllocationWebApi.Controllers
.InvestorRulesController.GetInvestors()
in E:\\CMAllocation\\WebServices\\CMAllocationWebApi
\\Debug\\approot\\src\\CMAllocation.Web.CMAllocationWebApi
\\Controllers\\InvestorRulesController.cs:line 45",
"RemoteStackTraceString":null,
"RemoteStackIndex":0,
"ExceptionMethod":
"1\n.ctor\nCMAllocation.Web.Data, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=null\nCMAllocation.Web.Data.InvestorRulesRepository\nVoid .ctor()",
"HResult":-2147024894,
"Source":"CMAllocation.Web.Data",
"WatsonBuckets":null,
"FileNotFound_FileName": "EntityFramework, Version=6.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089",
"FileNotFound_FusionLog":
"WRN: Assembly binding logging is turned OFF.\r\n
To enable assembly bind failure logging, set the registry value
[HKLM\\Software\\Microsoft\\Fusion!EnableLog] (DWORD) to 1.\r\n
Note: There is some performance penalty associated with
assembly bind failure logging.\r\n
To turn this feature off, remove the registry value
[HKLM\\Software\\Microsoft\\Fusion!EnableLog].\r\n"
}
Any help would be appreciated.
UPDATE I can clearly see the EF 6 dll's in the approot/packages folder:
Your server is missing 'EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies.
Build on the server with msbuild.
Run NuGet restore. Dave Ebbo has a good article. It is nuget restore from the cmd line.
If that doesn't work, install the EntityFramework package into the GAC on your server.
TFS 2013 - Build: ASP.Net 4.5.1 website I get this error:
warning MSB3268: The primary reference "C:\Builds\2\MyProj\Web1_Main\bin\MyProj1.dll"
could not be resolved because it has an indirect dependency on the framework assembly
"System.Runtime, Version=4.0.10.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" which
could not be resolved in the currently targeted framework. ".NETFramework,Version=v4.5.1". To resolve this problem, either remove the reference
"C:\Builds\2\MyProj\Web1_Main\bin\MyProj1.dll" or retarget your application to a framework
version which contains "System.Runtime, Version=4.0.10.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a".
All projects and site was 4.0 initially using Unity 1.0.0.0. I upgraded it to 4.5.2. Also the MyProj1 in the error above is referencing Unity and I upgraded it to 3.5.1 as well.
Read this: https://unity.codeplex.com/workitem/12756
The build server already have the updated 4.5.2 pointed in the workaround.
So I downgraded to 4.5.1 but still getting the error.
Solution builds fine locally via Visual studio 2013.
The stand alone class libraries project build in TFS fine but when MyProj is added as a reference to my Website, that's when it fails.
Any ideas?
Do I need any web.config changes other than TragetFramework settign while upgrading?
I had to upgrade my Unity to 3.5 due to my project's dependency on some other project and this error came again. This time, finally got it fixed.
This one helped me: http://devsilos.blogspot.com/2014/10/msb3268-while-targeting-aspnet-web-site.html
Solution I copied all the files that build was complaining about from:
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5.2\Facades
To
C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5.2
Here's the explanation from the link above in case it goes down for any reason in future:
A deeper inspection revealed the following interesting fact:
aspnet_compiler for some reason does not take into account the .dll-s
that reside under the Facade directory of 4.5 assemblies (C:\Program
Files (x86)\Reference
Assemblies\Microsoft\Framework.NETFramework\v4.5\Facades). It looks
only under C:\Program Files (x86)\Reference
Assemblies\Microsoft\Framework.NETFramework\v4.5
As a result the whole thing failed since both System.Threading.Tasks
and System.Runtime .dll-s were under the Facades directory and not
inside the v4.5.
Now the solutions:
Just simply copy the missing .dll-s from Facade to the v4.5
directory.
Set the TargetFrameworkMoniker to 4.5.1 in the .sln file. The exact
syntax is as follows: TargetFrameworkMoniker =
".NETFramework,Version%3Dv4.5.1".
What happens in this case is that the aspnet_compiler does not
recognize the exact version of the required framework and tries to
use the GAC wherever it can. If 4.5 is the highest version installed
on the build machine I believe it should work.
Actually sorry I don't think "assemblyBinding" would help.
It seems like a known bug. It has not been resolved. Using Unity 3.5 you can target .NET 4.5.1 but not 4.5.2.
So one option would be to re-target to .NET 4.5.1 and see if the problem goes away, if that's an option.
p.s.
Also you can try .NET Framework 4.5.2 Developer Pack. But some have mentioned it did not work.
We recently ran into a similar problem with a site that was upgraded to target .NET 4.5, and initially followed the solution in gbs's answer.
In our case, we had several warnings following this pattern:
<project name>.metaproj : warning MSB3268: The primary reference "<project reference>.dll" could not be resolved because it has an indirect dependency on the framework assembly "System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" which could not be resolved in the currently targeted framework. ".NETFramework,Version=v4.5". To resolve this problem, either remove the reference "<project reference>.dll" or retarget your application to a framework version which contains "System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
We then discovered that if you create a new web site targeting 4.5.x (File > New > Web Site...) and select the ASP.NET Empty Web Site template, the package Microsoft.Net.Compilers is included. Adding this package to our site resolved the issue without the need to touch the reference assemblies.
Of the original two solutions, copying the files caused the build to succeed but presented maintenance concerns, and changing the TargetFrameworkMoniker (to 4.5.3 rather than 4.5.1) produced a different build error and was a brittle solution.