Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could not load file or assembly in VS2017 with IIS express

We have a ASP.NET project in the company that runs for 5/6 developers. All Visual Studio 2017 and debug on IIS Express, no crazy setting or anything to make it run.

1 colleague cannot get it to work, he always gets the following exception:

enter image description here

We had this problem a few months back, then out of frustration the PC was re-installed and the problem was gone. He didn't develop for a few weeks and today the problem appeared again.

I searched long and far but it's such a generic error I can't really figure this one out.

When I run the fusion log viewer I see the following result:

https://pastebin.com/aCVZn3EB

The operation failed.
Bind result: hr = 0x80131018. No description available.

Assembly manager loaded from:  C:\Windows\Microsoft.NET\Framework64\v4.0.30319\clr.dll
Running under executable  C:\Program Files\IIS Express\iisexpress.exe
--- A detailed error log follows. 

=== Pre-bind state information ===
LOG: DisplayName = System.ServiceModel.Activities, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
 (Fully-specified)
LOG: Appbase = file:///C:/Users/User/Projects/project/project.UserSite/
LOG: Initial PrivatePath = C:\Users\User\Projects\project\project.UserSite\bin
LOG: Dynamic Base = C:\Users\User\AppData\Local\Temp\Temporary ASP.NET Files\vs\e0254dae
LOG: Cache Base = C:\Users\User\AppData\Local\Temp\Temporary ASP.NET Files\vs\e0254dae
LOG: AppName = 38c6ff11
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Users\User\Projects\project\project.UserSite\web.config
LOG: Using host configuration file: C:\Users\User\Documents\IISExpress\config\aspnet.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Binding succeeds. Returns assembly from C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.ServiceModel.Activities\v4.0_4.0.0.0__31bf3856ad364e35\System.ServiceModel.Activities.dll.
LOG: Assembly is loaded in default load context.
ERR: Unrecoverable error occurred during pre-download check (hr = 0x80131018).

*** Assembly Binder Log Entry  (7/18/2017 @ 8:55:15 AM) ***
like image 542
Roger Far Avatar asked Jul 07 '17 22:07

Roger Far


3 Answers

Are you trying to load a .NET 4 assembly with an EXE that asked for a diferrent CLR version? That requires an app.exe.config file that forces CLR 4 to be used.

Also please check the he has the same version of .NET installed.

like image 183
Mihail Stancescu Avatar answered Sep 28 '22 07:09

Mihail Stancescu


1- Close Visual Studio

2- Delete all files from "C:\WINDOWS\Microsoft.NET\Framework......\Temporary ASP.NET"

3- Open VS

4- Rebuild then run

like image 40
Yazan.Ati Avatar answered Sep 28 '22 07:09

Yazan.Ati


I have the same issue, its random. Just install missing package via Nuget for that project. Open Package Manager Console and type:

PM> Install-Package System.ServiceModel.Activities

and go on installing packages till there is no more error: then stop.

like image 37
one_mile_run Avatar answered Sep 28 '22 08:09

one_mile_run