我有一個.NET Core 3.1托管 REST 服務的應用程式,并且我正在為一些端點合并 SAP 連接器實用程式。我在 Windows 10 上。
RfcConfigParameters通過執行建立新端點時,我通過端點之一遇到錯誤RfcConfigParameters parameters = new RfcConfigParameters()
錯誤跟蹤如下:
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
我已經關注了很多關于解決與此類似的問題的文章和指南,但未能解決它。我已啟用/禁用所有 Windows 功能。我已從ServiceModelIIS 模塊中洗掉。我什至完全禁用了.NET 3.5,感覺好像有沖突。我曾嘗試通過注冊 .NET v4,aspnet_regiis.exe -iru但它告訴我通過“Windows 功能”或“dism”來管理它,我已經這樣做了。
以下是一些可以幫助解決我的問題的螢屏截圖:

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.
請幫忙!謝謝你。
uj5u.com熱心網友回復:
我想,這不是你想聽到的,但是請查看 NCo 3.0 的發布和支持策略。它說:
支持的 Microsoft .NET Framework為 2.0、3.0、3.5、4.0、4.5、4.6、4.7 和 4.8。
這意味著NCo 根本不支持.NET Core 。.NET Core 與經典的 .NET 框架不同。如果您的應用程式必須是 .NET Core 應用程式,那么我懷疑您是否能夠使用當前的 SAP NCo。
不幸的是,SAP 還沒有宣布任何適用于 .NET Core 環境的 NCo 版本。
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/414085.html
標籤:
