Could not load file or assembly 'System.Web.Services, Version=4.0.0.0

-1

I have successfully integrated sales force SOAP api in to .Net Standard 2.0 class library project and its working fine. Now when I am trying to use this class library to call salesforce into ASP.NET Core2.2 project its giving me error as:

Could not load file or assembly 'System.Web.Services, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. Reference assemblies should not be loaded for execution. They can only be loaded in the Reflection-only loader context. (Exception from HRESULT: 0x80131058)

I have placed System.Web.Services.dll in ASP.NET Coere2.2 projects bin and obj folder but it doesn't resolved this issue. I also followed instructions as given below but its also not working

https://forums.asp.net/t/2169403.aspx?How+to+resolve+Could+not+load+file+or+assembly+System+Web+Services+Version+4+0+0+0+Culture+neutral+PublicKeyToken+b03f5f7f11d50a3a+The+system+cannot+find+the+file+specified+

c#
asp.net-core
soap
salesforce
.net-standard
asked on Stack Overflow Nov 29, 2020 by yadavr

1 Answer

0

It may be because that library is not compatible with ASP.NET Core. See the comments in the link you provided relating to this:

Correct me if I'm wrong but the reference documentation clearly and openly states that System.Web.Services is not part of the .NET standard or .NET Core. The library cannot be used in a Core project. It seems your experiment proves this.

You can try to make a new .NET Framework project that ingests the Salesforce SOAP API and expose it in that way to your .NET Core application. Of course, it would not be a direct reference to the .NET Framework application but a more "portable" method like an HTTP web service.

answered on Stack Overflow Nov 29, 2020 by John

User contributions licensed under CC BY-SA 3.0