Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could not load file or assembly 'System.ServiceModel.Primitives, Version=4.2.0.0 #2885

Closed
ssashok10 opened this issue May 20, 2018 · 16 comments
Assignees

Comments

@ssashok10
Copy link

I am using Azure Function (C#) which is calling a .NET standard library to call an external WCF service and I am getting the below error. This file is located on the bin folder of my function and the version also correct.

Could not load file or assembly 'System.ServiceModel.Primitives, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.

Here are the platform information,
Microsoft.NET.Sdk.Functions (1.0.13)
.NET Standard Library 2.0
System.ServiceModel.Duplex 4.4.2
System.ServiceModel.Http 4.4.2
System.ServiceModel.NetTcp 4.4.2
System.ServiceModel.Security 4.4.2

@zhenlan
Copy link
Member

zhenlan commented May 21, 2018

Hi @ssashok10, just to help understand, what's the difference of this Azure Function app than the one you had in #2824?

@ssashok10
Copy link
Author

The issue #2824 is different than this issue. The DLL is not copied into the "bin" folder on the issue #2824. Here we are seeing the DLL "System.ServiceModel.Primities" into the bin folder and version also matching. However, the function run time is not able to load it for some reason.

@zhenlan
Copy link
Member

zhenlan commented May 21, 2018

@ssashok10, I understand what you described. I am trying to see what caused this result, so that's why my question about what's the difference between the two projects (the project in this issue and the project in #2824). The difference between the two projects may help us to tell why the issue happens to one project but not the other.

@ssashok10
Copy link
Author

@zhenlan It's the same project. We initially had an issue with "System.private.servicemodel.dll" which doesn't exist on the bin folder. We overcome this issue with your work around and we ended up facing the current issue. We are able to see the DLL "system.servicemodel.primitives.dll" into the BIN folder with the right version.

@zhenlan
Copy link
Member

zhenlan commented May 22, 2018

I see. Looks like somehow the project was trying to use an older version of S.SM.Primitives package. Does it help if you add package reference of System.ServiceModel.Primitives 4.4.2 explicitly to your project?

@ssashok10
Copy link
Author

we tried to add it explicitly and it's not helping at all as the DLL already exists in the bin folder. However, we are able to solve this issue something similar in the below article during runtime.

http://putridparrot.com/blog/dynamically-resolve-assemblies-at-runtime/

@zhenlan
Copy link
Member

zhenlan commented May 22, 2018

I didn't have this issue last time when I tried .NET Core Azure Functions. At this point, it probably will be helpful if you can share a repro for further investigation.

The blog post is about full framework, so I assume you worked around the issue by implementing assembly resolver using .NET Core APIs?

@ssashok10
Copy link
Author

yes...we fixed this issue with assembly resolver.

@Lxiamail Lxiamail self-assigned this May 25, 2018
@Lxiamail Lxiamail added this to the 3.0 milestone May 25, 2018
@zhenlan zhenlan added the bug This is a product bug. label Jun 27, 2018
@Lxiamail
Copy link
Member

Lxiamail commented Nov 8, 2018

@ssashok10 Looks like the fix in Azure function may have fixed your problem. Have you tried it?

@Lxiamail Lxiamail added tracking and removed bug This is a product bug. labels Nov 8, 2018
@chadgruka
Copy link

This is also an issue for me. Seems to crop up when referencing BasicHttpBinding or other Binding objects in code. I don't recall this being an issue a couple months back, as I have check-ins that were additive mid-to-late August.

I'm seeing this inside Azure Functions and Console apps. I'm running the latest VS Pro 2017 preview (15.9.5)

Hope this helps...

@melzoghbi
Copy link

I am facing the same issue using azure runtime Version: 2.0.12245.0 in VS2017. After i added the ServiceModel Primitives nuget package i get the following error:

Could not load file or assembly 'System.Private.ServiceModel, Version=4.5.0.3, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.

Any fix for this issue or workaround?

Thanks.

@Lxiamail
Copy link
Member

@chadgruka Have you tried the new Azure function version with the fix? When you say the issue repro with "Console apps", can you share concrete repro steps?

@chadgruka
Copy link

Sorry, this is 2 months ago. I'll have to see where we landed on this since.

@Lxiamail
Copy link
Member

@melzoghbi Have you tried the new Azure function version with the fix? If the issue that you ran into is about missing System.Private.ServiceModel.dll in Azure Function output directory, it may due to a different Azure function issue. Can you try the work around suggested by Zhenlan in #dotnet/wcf#2824 ?

@Lxiamail
Copy link
Member

@chadgruka Thanks

@Lxiamail
Copy link
Member

Closing this issue. If you still run into the same issue. Please try the new Azure function version with the fix. If it doesn't work, please open new issue in https://github.com/Azure/azure-functions-host repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants