0

After publishing my ASP .net 5 project to IIS, I was getting an error:

System.TypeLoadException: Could not load type 'Microsoft.AspNet.Builder.RequestDelegate' from assembly 'Microsoft.AspNet.Http.Abstractions'

According to a few posts it seems that the cause was that the package versions were not in sync. I checked my approot/packages folder and found that many packages had the incorrect version (rc2) when my site was published with rc1-final. I deleted those packages because the correct versions were also there, but now I am getting the following error:

System.IO.FileNotFoundException: The system cannot find the file specified. (Exception from HRESULT: 0x80070002)
   at System.Reflection.RuntimeAssembly.nLoadFile(String path, Evidence evidence)
   at System.Reflection.Assembly.LoadFile(String path)

How do I fix my published project to resolve to the correct versions? All my references in my project.json point explicitly to rc1-final. Here is my depency section in my project.json:

  "dependencies": {
    "Microsoft.AspNet.Diagnostics": "1.0.0-rc1-final",
    "Microsoft.AspNet.IISPlatformHandler": "1.0.0-rc1-final",
    "Microsoft.AspNet.Mvc": "6.0.0-rc1-final",
    "Microsoft.AspNet.Mvc.Core": "6.0.0-rc1-final",
    "Microsoft.AspNet.Mvc.ViewFeatures": "6.0.0-rc1-final",
    "Microsoft.AspNet.Server.Kestrel": "1.0.0-rc1-final",
    "Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0-rc1-final",
    "Microsoft.Extensions.Logging": "1.0.0-rc1-final",
    "Microsoft.Extensions.Logging.Console": "1.0.0-rc1-final",
    "Microsoft.Net.Http": "2.2.22",
    "Microsoft.Extensions.Configuration": "1.0.0-rc1-final",
    "Microsoft.Extensions.Configuration.Abstractions": "1.0.0-rc1-final",
    "Microsoft.Extensions.Configuration.Json": "1.0.0-rc1-final",
    "Microsoft.Extensions.Configuration.FileExtensions": "1.0.0-rc1-final",
    "Microsoft.AspNet.StaticFiles": "1.0.0-rc1-final",

    "EntityFramework.MicrosoftSqlServer": "7.0.0-rc1-final",
    "EntityFramework.Core": "7.0.0-rc1-final",
    "EntityFramework.Commands": "7.0.0-rc1-final",

    "Microsoft.AspNet.Identity.EntityFramework": "3.0.0-rc1-final",
    "Sendgrid": "6.1.0",
    "Sendgrid.Webhooks": "1.1.0",
    "Microsoft.AspNet.SignalR.Server": "3.0.0-rc1-final",
    "RabbitMQ.Client": "3.5.6"

  },
Tjaart
  • 3,912
  • 2
  • 37
  • 61

1 Answers1

0

Considering that you are referencing SignalR I guess you are not on the standard NuGet server but a CI build. I think you have mismatching transitive dependencies (e.g. Microsoft.AspNet.Http.Abstractions from the CI Build and Microsoft.AspNet.Http.Abstraction from the nuget feed).

Try remove SignalR and switch to the default nuget feed, delete your packages folder and restore. It should run then.

I think it was David Fowler the architect of ASP.NET Core who said once, that you should not mix the different feeds. Nothing good comes out there.

Thomas
  • 5,080
  • 27
  • 42
  • It is not really ideal to run package restore on a published site for me. I want to understand how the paths are resolved, because I deleted the invalid packages. Where does the runtime find the paths to the assemblies? Why is it looking for those specific versions, when my packages folder no longer contains them? – Tjaart Feb 01 '16 at 07:40
  • Well ... The nugets content DLL are deployed to the publised package. The NuGet packages should not be used. – Thomas Feb 01 '16 at 08:36