6

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) ***
Roger Far
  • 2,178
  • 3
  • 36
  • 67
  • Just for fun, can you go into the solution > Reference > System.ServiceModel.Activities > Properties and verify that the property "specific Version" is set to false. – Travis Acton Jul 10 '17 at 15:25
  • @TravisActon yes it's set to false. – Roger Far Jul 10 '17 at 22:24
  • Is there anything further down the stack trace? Perhaps something in the event log? – Henrik Clausen Jul 13 '17 at 18:07
  • Does he run same version of IISExpress as you do (https://ppolyzos.com/2015/12/01/enable-x64-bit-version-of-iis-express/) ? And can you share the web.config ? – Ondrej Svejdar Jul 14 '17 at 12:59
  • 2
    Enable fusion log to locate where this problematic assembly is (its full path), and then use a tool such as ILSpy to analyze the assembly and compare with another machine. – Lex Li Jul 14 '17 at 18:04
  • Maybe try to copy the missing assembly dll directly to the output (bin) directory of the solution? – Sebastian Brand Jul 15 '17 at 10:19
  • Thanks for the all the suggestions, colleague has been gone for few days, but I'll try them all this coming week. – Roger Far Jul 16 '17 at 21:15
  • 1
    https://stackoverflow.com/questions/255669/how-to-enable-assembly-bind-failure-logging-fusion-in-net and after analyze log – Mihail Kuznesov Jul 17 '17 at 05:18
  • @MihailKuznesov I enabled it and updated the start post with the results. But I can't figure out who is causing it. To be clear, System.ServiceModel.Activities is not actually used in the project, so it must be loaded by something else. – Roger Far Jul 18 '17 at 15:07

4 Answers4

2

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.

Mihail Stancescu
  • 4,088
  • 1
  • 16
  • 21
1

1- Close Visual Studio

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

3- Open VS

4- Rebuild then run

Yazan.Ati
  • 31
  • 1
1

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.

one_mile_run
  • 3,264
  • 4
  • 26
  • 29
  • It does work fine on the rest of our machines so this would be a last resort, it would increase the build time and artifact size quite a bit. – Roger Far Jul 17 '17 at 15:07
1

Turns out with the help of Fusion Log I found 1 file that was 0kb in size: C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.ServiceModel.Activities\v4.0_4.0.0.0__31bf3856ad364e35\System.ServiceModel.Activities.dll

I restored the file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\System.ServiceModel.Activities.dll and it worked again!

Roger Far
  • 2,178
  • 3
  • 36
  • 67