0

Error:

Method 'MyController' in type 'MyProject.AppStart.Selector' from assembly 'MyProject, Version=1.0.0.0, Culture=neutral, PublicKeyToken=......' does not have an implementation.

Background: I have an ASP.NET project with target framework set to .NET Framework 4.6.2. After installing Microsoft.Azure.SignalR.AspNet 1.0.0-preview1-103a17from nuget package manager, it builds and runs fine on Visual Studio 2017. No problem at all. When I deploy the release to my server and try to access any of its services, I get the above-mentioned error. The method is implemented in a class which implements System.Web.Http.Dispatcher.IHttpControllerSelector.

Configuration:

  • The machine on which code works: Windows 10 Version 1809 (OS Build 17763.316). Visual Studio 2017 15.9.6.

enter image description here

  • The machine on which code does not work: Windows Server 2012 R2 Version 6.2 Build 9200. IIS version 8.5.9600.16384.

enter image description here

What I tried:

  • Clean/Rebuild deploy again.
  • Delete obj and bin folder, publish and deploy again.
  • Deleted CachedAssessmbly as suggested here.
  • Change Configuration from Release to Debug.
  • Install Azure SDK in the Windows Server 2012 R2 machine.
  • Try to install the dependencies of Microsoft.Azure.SignalR.AspNet without directly installing Microsoft.Azure.SignalR.AspNet. It appears that the error starts to Microsoft.Azure.SignalR.Protocols is installed. The dependencies of the Microsoft.Azure.SignalR.Protocols are:

enter image description here

All of these four dependencies are being added when I install Microsoft.Azure.SignalR.Protocols i.e. they are not already being used.

I can't seem to find the issue.

Update: I deployed the folder on the above mentioned Windows 10 machine and used IIS Manager to create an application. The application works fine on the same machine without Visual Studio.

tehmas
  • 164
  • 1
  • 8

1 Answers1

0

In the Windows Server 2012 R2 machine, I had originally installed .NET Core 2.2 runtime instead of the SDK. I installed the following in order:

  1. .NET Core 2.2 SDK (deployment still didn't work)
  2. .NET Framework 4.7.2 Dev Pack (asked for restarted, postponed it)
  3. .NET Framework 4.6.1 Dev Pack

After installing the .NET Framework 4.6.1 Dev Pack, I restarted. And now the deployment works.

I can't pinpoint the solution but my guess is that installing .NET Core 2.2 SDK fixed the issue. After it got installed, the installation window prompted some version of Microsoft.AspNetCore has been installed. It didn't ask for a restart but I guess as .NET Core 2.2 Runtime was already installed and being used by another application, a restart was needed.

It is quite strange that Microsoft.AspNetCore wasn't installed along with .NET Core 2.2 Runtime.

It took quite some time to fix this issue as typeloadexception can arise in many other scenarios.

Hope this solution helps other people as well.

tehmas
  • 164
  • 1
  • 8