I have a .net core API version 3.1 which is having dependency on 2 projects.
Legacy .Net Framework 4.7 project using framework dlls - System.Web.Services and System.Configuration for calling Soap based asmx web service and for reading configuration from web.confg respectively.
Inside .Net Standard library i created below AuthorizationFilter by adding package Microsoft.AspNetCore.Mvc.Abstractions
/// <inheritdoc/>
public void OnAuthorization(AuthorizationFilterContext context)
{
if (!AllPossibleLocalHostUrls.Any(x => x.Equals(context.HttpContext.Request.Host.Value, StringComparison.OrdinalIgnoreCase)))
{
context.Result = null;
}
}
Once the package Microsoft.AspNetCore.Mvc.Abstractions
is added during application startup get below error:
System.Reflection.ReflectionTypeLoadException: 'Unable to load one or more of the requested types. 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. Could not load file or assembly 'System.Configuration.ConfigurationManager, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The located assembly's manifest definition does not match the assembly reference. (0x80131040)'
I am able to resolve the 2nd error by adding nuget package System.Configuration.ConfigurationManager inside .Net Standard Library project. But for System.Web.Services unable to find any nuget package available for .Net Core applications.
User contributions licensed under CC BY-SA 3.0