.NET Core 3.1 - SAP Connector - Could not load type 'System.ServiceModel.Activation.VirtualPathExtension'
I have a .NET Core 3.1
Application that's hosting REST services and I'm incorporating the SAP Connector utilities for some of the endpoints. I'm on Windows 10.
I'm running into an error through one of the endpoints when establishing new RfcConfigParameters
by doing RfcConfigParameters parameters = new RfcConfigParameters()
The error trace is as follows:
2022-01-14 12:49:41.982 -05:00 [ERR] LookupRfcAttributes Error: System.TypeLoadException: Could not load type 'System.ServiceModel.Activation.VirtualPathExtension' from assembly 'System.ServiceModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
at SAP.Middleware.Connector.RfcConfigParameters.LoadConfiguration()
at SAP.Middleware.Connector.RfcConfigParameters..cctor()
2022-01-14 12:49:42.781 -05:00 [ERR] An unhandled exception has occurred, The type initializer for 'SAP.Middleware.Connector.RfcConfigParameters' threw an exception.
System.Exception: The type initializer for 'SAP.Middleware.Connector.RfcConfigParameters' threw an exception.
at SAPConnector.API.Services.SAPService.LookupRfcAttributes(AttributeLookupRequest attributeRequest) in C:\Users\nbaki.DOMARI\Projects\SAPConnector\SAPConnector.API\Services\SAPService.cs:line 55
at SAPConnector.API.Controllers.SAPController.AttributeLookup(LookupRequest lookupRequest) in C:\Users\nbaki.DOMARI\Projects\SAPConnector\SAPConnector.API\Controllers\SAPController.cs:line 221
at lambda_method(Closure , Object )
at Microsoft.Extensions.Internal.ObjectMethodExecutorAwaitable.Awaiter.GetResult()
at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeFilterPipelineAsync>g__Awaited|19_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
at NSwag.AspNetCore.Middlewares.SwaggerUiIndexMiddleware.Invoke(HttpContext context)
at NSwag.AspNetCore.Middlewares.RedirectToIndexMiddleware.Invoke(HttpContext context)
at NSwag.AspNetCore.Middlewares.OpenApiDocumentMiddleware.Invoke(HttpContext context)
at CorrelationId.CorrelationIdMiddleware.Invoke(HttpContext context, ICorrelationContextFactory correlationContextFactory)
at SAPConnector.API.Middleware.ApiExceptionHandlingMiddleware.Invoke(HttpContext context) in C:\Users\nbaki.DOMARI\Projects\SAPConnector\SAPConnector.API\Middleware\ApiExceptionHandlingMiddleware.cs:line 32
I have followed so many articles & guides on fixing issues similar to this and have not been able to resolve it. I have enabled/disabled all Windows features. I have removed ServiceModel
from the IIS Modules. I even disabled .NET 3.5 completely feeling as though there's a conflict. I have tried registering .NET v4 through aspnet_regiis.exe -iru
but it tells me manage this through "Windows Features" or through "dism", which I have done.
Below are some screenshots that could help aid my question:
C:\Windows\Microsoft.NET\Framework64\v4.0.30319>dism /online /get-features
Deployment Image Servicing and Management tool
Version: 10.0.19041.844
Image Version: 10.0.19042.1415
Features listing for package : Microsoft-Windows-Foundation-Package~31bf3856ad364e35~amd64~~10.0.19041.1
Feature Name : Printing-PrintToPDFServices-Features
State : Enabled
Feature Name : Printing-XPSServices-Features
State : Enabled
Feature Name : TelnetClient
State : Disabled
Feature Name : TFTP
State : Disabled
Feature Name : LegacyComponents
State : Disabled
Feature Name : DirectPlay
State : Disabled
Feature Name : SimpleTCP
State : Disabled
Feature Name : Windows-Identity-Foundation
State : Disabled
Feature Name : NetFx3
State : Disabled with Payload Removed
Feature Name : WCF-HTTP-Activation
State : Disabled
Feature Name : WCF-NonHTTP-Activation
State : Disabled
Feature Name : IIS-WebServerRole
State : Enabled
Feature Name : IIS-WebServer
State : Enabled
Feature Name : IIS-CommonHttpFeatures
State : Enabled
Feature Name : IIS-HttpErrors
State : Enabled
Feature Name : IIS-HttpRedirect
State : Enabled
Feature Name : IIS-ApplicationDevelopment
State : Enabled
Feature Name : IIS-Security
State : Enabled
Feature Name : IIS-RequestFiltering
State : Enabled
Feature Name : IIS-NetFxExtensibility
State : Disabled
Feature Name : IIS-NetFxExtensibility45
State : Enabled
Feature Name : IIS-HealthAndDiagnostics
State : Enabled
Feature Name : IIS-HttpLogging
State : Enabled
Feature Name : IIS-LoggingLibraries
State : Disabled
Feature Name : IIS-RequestMonitor
State : Enabled
Feature Name : IIS-HttpTracing
State : Disabled
Feature Name : IIS-URLAuthorization
State : Disabled
Feature Name : IIS-IPSecurity
State : Disabled
Feature Name : IIS-Performance
State : Enabled
Feature Name : IIS-HttpCompressionDynamic
State : Enabled
Feature Name : IIS-WebServerManagementTools
State : Enabled
Feature Name : IIS-ManagementScriptingTools
State : Enabled
Feature Name : IIS-IIS6ManagementCompatibility
State : Enabled
Feature Name : IIS-Metabase
State : Enabled
Feature Name : WAS-WindowsActivationService
State : Enabled
Feature Name : WAS-ProcessModel
State : Enabled
Feature Name : WAS-NetFxEnvironment
State : Disabled
Feature Name : WAS-ConfigurationAPI
State : Enabled
Feature Name : IIS-HostableWebCore
State : Disabled
Feature Name : WCF-Services45
State : Enabled
Feature Name : WCF-HTTP-Activation45
State : Enabled
Feature Name : WCF-TCP-Activation45
State : Enabled
Feature Name : WCF-Pipe-Activation45
State : Enabled
Feature Name : WCF-MSMQ-Activation45
State : Enabled
Feature Name : WCF-TCP-PortSharing45
State : Enabled
Feature Name : IIS-StaticContent
State : Enabled
Feature Name : IIS-DefaultDocument
State : Enabled
Feature Name : IIS-DirectoryBrowsing
State : Enabled
Feature Name : IIS-WebDAV
State : Disabled
Feature Name : IIS-WebSockets
State : Disabled
Feature Name : IIS-ApplicationInit
State : Disabled
Feature Name : IIS-ASPNET
State : Disabled
Feature Name : IIS-ASPNET45
State : Enabled
Feature Name : IIS-ASP
State : Enabled
Feature Name : IIS-CGI
State : Disabled
Feature Name : IIS-ISAPIExtensions
State : Enabled
Feature Name : IIS-ISAPIFilter
State : Enabled
Feature Name : IIS-ServerSideIncludes
State : Enabled
Feature Name : IIS-CustomLogging
State : Disabled
Feature Name : IIS-BasicAuthentication
State : Enabled
Feature Name : IIS-HttpCompressionStatic
State : Enabled
Feature Name : IIS-ManagementConsole
State : Enabled
Feature Name : IIS-ManagementService
State : Enabled
Feature Name : IIS-WMICompatibility
State : Disabled
Feature Name : IIS-LegacyScripts
State : Disabled
Feature Name : IIS-LegacySnapIn
State : Disabled
Feature Name : IIS-FTPServer
State : Disabled
Feature Name : IIS-FTPSvc
State : Disabled
Feature Name : IIS-FTPExtensibility
State : Disabled
Feature Name : MSMQ-Container
State : Enabled
Feature Name : MSMQ-DCOMProxy
State : Disabled
Feature Name : MSMQ-Server
State : Enabled
Feature Name : MSMQ-ADIntegration
State : Disabled
Feature Name : MSMQ-HTTP
State : Disabled
Feature Name : MSMQ-Multicast
State : Disabled
Feature Name : MSMQ-Triggers
State : Disabled
Feature Name : IIS-CertProvider
State : Disabled
Feature Name : IIS-WindowsAuthentication
State : Enabled
Feature Name : IIS-DigestAuthentication
State : Disabled
Feature Name : IIS-ClientCertificateMappingAuthentication
State : Disabled
Feature Name : IIS-IISCertificateMappingAuthentication
State : Disabled
Feature Name : IIS-ODBCLogging
State : Disabled
Feature Name : MediaPlayback
State : Enabled
Feature Name : WindowsMediaPlayer
State : Enabled
Feature Name : DataCenterBridging
State : Disabled
Feature Name : SmbDirect
State : Enabled
Feature Name : HostGuardian
State : Disabled
Feature Name : SearchEngine-Client-Package
State : Enabled
Feature Name : MSRDC-Infrastructure
State : Enabled
Feature Name : TIFFIFilter
State : Disabled
Feature Name : MicrosoftWindowsPowerShellV2Root
State : Enabled
Feature Name : MicrosoftWindowsPowerShellV2
State : Enabled
Feature Name : NetFx4-AdvSrvs
State : Enabled
Feature Name : NetFx4Extended-ASPNET45
State : Enabled
Feature Name : SMB1Protocol-Deprecation
State : Enabled
Feature Name : MultiPoint-Connector
State : Disabled
Feature Name : MultiPoint-Connector-Services
State : Disabled
Feature Name : MultiPoint-Tools
State : Disabled
Feature Name : AppServerClient
State : Disabled
Feature Name : Windows-Defender-Default-Definitions
State : Enabled
Feature Name : WorkFolders-Client
State : Enabled
Feature Name : Client-ProjFS
State : Disabled
Feature Name : SMB1Protocol
State : Enabled
Feature Name : SMB1Protocol-Client
State : Enabled
Feature Name : SMB1Protocol-Server
State : Enabled
Feature Name : Internet-Explorer-Optional-amd64
State : Enabled
Feature Name : Printing-Foundation-Features
State : Enabled
Feature Name : Printing-Foundation-InternetPrinting-Client
State : Enabled
Feature Name : Printing-Foundation-LPDPrintService
State : Disabled
Feature Name : Printing-Foundation-LPRPortMonitor
State : Disabled
Feature Name : Client-DeviceLockdown
State : Disabled
Feature Name : Client-EmbeddedShellLauncher
State : Disabled
Feature Name : Client-EmbeddedBootExp
State : Disabled
Feature Name : Client-EmbeddedLogon
State : Disabled
Feature Name : Client-KeyboardFilter
State : Disabled
Feature Name : Client-UnifiedWriteFilter
State : Disabled
Feature Name : ServicesForNFS-ClientOnly
State : Disabled
Feature Name : ClientForNFS-Infrastructure
State : Disabled
Feature Name : NFS-Administration
State : Disabled
Feature Name : Microsoft-Windows-Subsystem-Linux
State : Disabled
Feature Name : HypervisorPlatform
State : Disabled
Feature Name : VirtualMachinePlatform
State : Disabled
Feature Name : Containers-DisposableClientVM
State : Disabled
Feature Name : Microsoft-Hyper-V-All
State : Disabled
Feature Name : Microsoft-Hyper-V
State : Disabled
Feature Name : Microsoft-Hyper-V-Tools-All
State : Disabled
Feature Name : Microsoft-Hyper-V-Management-PowerShell
State : Disabled
Feature Name : Microsoft-Hyper-V-Hypervisor
State : Disabled
Feature Name : Microsoft-Hyper-V-Services
State : Disabled
Feature Name : Microsoft-Hyper-V-Management-Clients
State : Disabled
Feature Name : DirectoryServices-ADAM-Client
State : Disabled
Feature Name : Windows-Defender-ApplicationGuard
State : Disabled
Feature Name : Containers
State : Disabled
The operation completed successfully.
Please help! Thank you.
Solution 1:
I guess, this is not what you would like to hear, but please check the release and support strategy of NCo 3.0. It says:
The supported Microsoft .NET Frameworks are 2.0, 3.0, 3.5, 4.0, 4.5, 4.6, 4.7, and 4.8.
This means .NET Core is not supported at all by NCo. .NET Core is not the same as the classic .NET framework. If your application must be a .NET Core application, I doubt that you will be able to use the current SAP NCo at all then.
Unfortunately, SAP also did not announce any NCo version for .NET Core environments yet.