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.Net.Http.WebRequest, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. #997

Closed
sjha2 opened this issue Oct 17, 2018 · 4 comments

Comments

@sjha2
Copy link

sjha2 commented Oct 17, 2018

I am facing issue while creating search client though it worked perfectly fine when I run locally.
I get below same error When I run function after publishing to Azure at
var indexClient = new SearchIndexClient("xxxxxxxxxxxx", "xxxxxxxxxxxxxxxxxxxxxxxxx",
new SearchCredentials("xxxxxxxxxxx"));

Error:
Could not load file or assembly 'System.Net.Http.WebRequest, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.

I have tried all the version of azure search but still not working.
Current nuget version:
Microsoft.Azure.Search : 5.0.0
Microsoft.NET.Sdk.Functions : 1.0.13

@JohnReeson
Copy link

System.Net.Http.WebRequest seems not available in ~2 runtime i.e. .NET Core env. What's your function runtime version?

@sjha2
Copy link
Author

sjha2 commented Oct 22, 2018

Yes System.Net.Http.WebRequest is not supported runtime 2.x.
When I change runtime to 1.x then it it works. any idea how Ican include in 2.x ?

@JohnReeson
Copy link

Unfortunately I don't find any way, I tried to work with PowerBIClient before, it leverages this assembly internally as well. The assembly can't even be loaded correctly in a simple .Net Core console app.

@jeffhollan
Copy link
Contributor

If it's supported by .NET Core 2.1 it should work in your function. However in this case it sounds like you are trying to leverage an assembly that isn't supported by .NET Core 2 which would be unsupported in v2 as it uses .NET Core to run. May be best to track the ask with the Azure Search SDK to provide a .NET Core compatible SDK, or use v1 for now.

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

3 participants