gpt4 book ai didi

c# - Microsoft.SqlServer.Types : Error loading msvcr120. dll(错误代码:5)

转载 作者:太空狗 更新时间:2023-10-29 20:22:56 45 4
gpt4 key购买 nike

在我们的项目中,我们使用以下 nuget 包:

Microsoft.SqlServer.Types

直到最近,一切都运行良好,没有我明显改变任何重要的东西,ASP.NET 应用程序在启动时中断,出现以下异常:

Error loading msvcr120.dll (ErrorCode: 5)

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Exception: Error loading msvcr120.dll (ErrorCode: 5)

堆栈跟踪:

[Exception: Error loading msvcr120.dll (ErrorCode: 5)]
SqlServerTypes.Utilities.LoadNativeAssembly(String nativeBinaryPath, String assemblyName) in E:\Dev\Jacobo\ServerApi\SqlServerTypes\Loader.cs:43
SqlServerTypes.Utilities.LoadNativeAssemblies(String rootApplicationPath) in E:\Dev\Jacobo\ServerApi\SqlServerTypes\Loader.cs:28
Jacobo.ServerApi.WebApiApplication.Application_Start() in E:\Dev\Jacobo\ServerApi\Global.asax.cs:26

[HttpException (0x80004005): Error loading msvcr120.dll (ErrorCode: 5)]
System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode(HttpContext context, HttpApplication app) +529
System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +185
System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +172
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +421
System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +359

[HttpException (0x80004005): Error loading msvcr120.dll (ErrorCode: 5)] System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +534 System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +117
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +726

应用程序在以下方法中中断:

private static void LoadNativeAssembly(string nativeBinaryPath, string assemblyName)
{
var path = Path.Combine(nativeBinaryPath, assemblyName);
var ptr = LoadLibrary(path);
if (ptr == IntPtr.Zero)
{
throw new Exception(string.Format(
"Error loading {0} (ErrorCode: {1})",
assemblyName,
Marshal.GetLastWin32Error()));
}
}

它是 loader.cs 的一部分,它是 SqlServerTypes nuget 包的一部分。

我检查了 bin 文件夹并找到了那里存在的 SqlServerTypes 程序集。我真的不确定这里出了什么问题。

enter image description here

最佳答案

我今天遇到了这个问题。我需要实现的修复是确保 SQL Server 类型文件是我项目的一部分,以便在发布输出中生成它们:

DLLs in solution explorer

只需确保为每个相关的 DLL 文件设置复制到输出目录。如果您在解决方案资源管理器中没有看到它们,您可能需要选择显示所有文件,然后右键单击它们以包含在项目中

Added unreferenced files in solution explorer

关于c# - Microsoft.SqlServer.Types : Error loading msvcr120. dll(错误代码:5),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46926286/

45 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com