我在解决方案文件中有20个项目.其中1个项目是所有项目都参考的标准库项目.
大约一年前,我们添加了一个新的nuget包,我们称之为Package A5.0.0.0版.它有一堆文件,它们会在编译时全部转移,但我们最终处理它.我们将包添加到我们的标准库项目(另一个参考的那个).
我是Nuget的新手(所以也许我做错了)所以我做了一个新包作为帮助Package A.我已经设置了所有内容,以便帮助程序依赖于Package A版本3.0.0.0到5.0.0.0(因此它适用于版本低于我们的其他人).让我们称这个新包Package A helper
我安装Package A helper,一切正常.我去做拉取请求,现在我们的解决方案中的每个app.config都有
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Package.A" publicKeyToken="8FC3CCAD86" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
Run Code Online (Sandbox Code Playgroud)
如果没有它,它将编译正常,但视觉工作室抱怨并发出警告.是什么赋予了?我的经理现在不会让我合并我的代码,因为它会给app.config增加太多噪音,并且过分依赖于Package A.
为什么Package A在我们安装之前已经满足主要依赖关系的时候添加依赖的nuget包必须拥有这个新的bindingRedirect Package A Helper?
当我在nuget包和package.config中指定3.0.0.0-5.0.0.0时,为什么会说0.0.0.0-5.0.0.0
更新:
当我Package A helper使用对Package A5.0.0.0版的引用构建时,所有bindingRedirects都不会在每个app.config中自动填充,而是生成警告.我最初用3.0.0.0构建它,因为我认为最好用最低的依赖构建它.问题仍然存在,因为visual studio仍然警告并建议创建bindingRedirects.
No way to resolve conflict between "Package A, Version=5.0.0.0, Culture=neutral, PublicKeyToken=83hfhsd33" and "Package A, Version=3.0.0.0, Culture=neutral, PublicKeyToken=83hfhsd33". Choosing "Package A, Version=5.0.0.0, Culture=neutral, PublicKeyToken=83hfhsd33" arbitrarily.
Consider …Run Code Online (Sandbox Code Playgroud) c# assemblybinding visual-studio nuget assembly-binding-redirect
我正在运行集成测试,当我到达那行代码时:
WebApiDependencyResolverConfig.Register(config);
Run Code Online (Sandbox Code Playgroud)
(在里面使用autofac容器)
我得到这个例外:
{"Could not load file or assembly 'System.Web.Http, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)":"System.Web.Http, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"}
Run Code Online (Sandbox Code Playgroud)
Fusionlog:
=== Pre-bind state information ===
LOG: DisplayName = System.Web.Http, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
(Fully-specified)
LOG: Appbase = file:///C:/TLP/TLP.API.IntegrationTests/bin/Debug
LOG: Initial PrivatePath = NULL
Calling assembly : Autofac.Integration.WebApi, Version=3.0.0.0, Culture=neutral, PublicKeyToken=17863af14b0044da.
===
LOG: This bind starts in default load context.
LOG: Using application configuration …Run Code Online (Sandbox Code Playgroud) 我正在尝试将程序集重定向从web.config外部文件移动到外部文件中.原因是我想在一个地方保持绑定重定向并在调试和生产配置上使用它.
它有点工作,但我很擅长指定相对路径.
<configuration>
<!-- this works, but forces me to use the same path on dev and production machines -->
<linkedConfiguration href="file://c:\data\web.runtime.config"/>
<!-- none of those works -->
<linkedConfiguration href="file://web.runtime.config"/>
<linkedConfiguration href="file://..\web.runtime.config"/>
<linkedConfiguration href="file://~/web.runtime.config"/>
</configuration>
Run Code Online (Sandbox Code Playgroud)
我想保留web.runtime.config与Web应用程序其余部分相同的文件夹.是否可以在linkedConfiguration元素中指定相对路径?
更多信息:我在VS 2015中使用IIS Express和ASP MVC应用程序对其进行了测试.使用SysInternals Process Monitor监视文件访问时,相对路径似乎解析为\\web.runtime.config(无效的网络路径),而在使用绝对路径时没有\\添加前导.
.net binding web-config assemblybinding assembly-binding-redirect
当我构建我的ASP.NET Web应用程序时,我在构建输出中看到以下奇怪的警告.
1>------ Build started: Project: Hornet.Api, Configuration: Debug Any CPU ------
1> No way to resolve conflict between "Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed" and "Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed". Choosing "Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed" arbitrarily.
1> No way to resolve conflict between "Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed" and "Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed". Choosing "Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed" arbitrarily.
1> Consider app.config remapping of assembly "Newtonsoft.Json, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed" from Version "9.0.0.0" [] to Version "10.0.0.0" [C:\Projects\Personal\Hornet\Hornet.Api\packages\Newtonsoft.Json.10.0.2\lib\net45\Newtonsoft.Json.dll] to solve conflict and get rid of …Run Code Online (Sandbox Code Playgroud) 似乎在我们的web.config中有太多绑定重定向,我要么:
这只是绑定重定向的某些部分的示例:
<dependentAssembly>
<assemblyIdentity name="Microsoft.Azure.KeyVault.Core" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Data.Services.Client" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.8.3.0" newVersion="5.8.3.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Data.OData" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.8.3.0" newVersion="5.8.3.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Data.Edm" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.8.3.0" newVersion="5.8.3.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Diagnostics.DiagnosticSource" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.2.1" newVersion="4.0.2.1" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Owin.Security" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.SqlServer.Types" publicKeyToken="89845dcd8080cc91" culture="neutral" />
<bindingRedirect oldVersion="10.0.0.0-11.0.0.0" …Run Code Online (Sandbox Code Playgroud) 由于跨受保护的网络共享移动和创建许多文件,我有一个应用程序需要进行大量模拟。我创建了一个简单的静态类,它有一个方法接受用户、域、密码和一个委托,其中包含您需要在模拟上下文下运行的代码。
\n\n我遇到的问题是当 CLR 尝试绑定到此上下文下引用的程序集时。抛出 FileLoadException 并显示“访问被拒绝”消息。
\n\n我相信这是由于模拟用户没有足够的权限访问文件系统下的 *.DLL 文件。例如,我可以在模拟块之前编写良性代码,这除了在上下文切换到模拟用户之前从问题程序集中加载类型之外什么也不做,这非常有效!然而,我真的不认为这是一个优雅的解决方案 \xe2\x80\x93 我是否需要开始担心我可以在模拟下使用哪些类型,确保我随机放置typeof()事先放置了随机语句?
更令人沮丧的是,我在本地开发计算机上没有遇到这个问题。当程序集被运送到测试环境时,就会出现此问题。而且我无权从测试环境中读取文件权限来尝试在我的本地计算机上模仿它们。
\n\n无论如何,我尝试了这个解决方案:
\n\n// Defined above:\n// System.Security.Principal.WindowsIdentity identity;\n// System.Security.Principal.WindowsImpersonationContext context;\n\ncontext = identity.Impersonate();\n\nint tries = 0;\nwhile ( true )\n{\n try\n {\n contextAction();\n }\n catch ( FileLoadException ex )\n {\n if ( tries > MAX_TRIES )\n {\n // don't allow an infinite loop\n throw;\n }\n if ( String.IsNullOrEmpty( ex.FileName ) )\n {\n // if this is null/empty, we can't really recover\n throw;\n }\n context.Undo(); // …Run Code Online (Sandbox Code Playgroud) 我不知道为什么我似乎无法弄清楚这一点.我有点强大的DLL命名地狱.这是发生了什么:
Microsoft.Web.Helpers库中使用Gravatar Razor助手它可以在我的机器上运行,但是在通过Git部署到Azure之后,我在调用Gravatar帮助器时遇到以下异常:
无法加载文件或程序集'System.Web.Helpers,Version = 2.0.0.0,Culture = neutral,PublicKeyToken = 31bf3856ad364e35'或其依赖项之一.该系统找不到指定的文件.
似乎我System.Web.Helpers在GAC上安装的任何托管我的Azure网站的版本与我的目标之间存在不匹配.
这是我尝试过的:
另外,我在web.config中有以下程序集绑定重定向:
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
</dependentAssembly>
...
</runtime>
Run Code Online (Sandbox Code Playgroud)
任何人??
.net azure assemblybinding visual-studio-2012 azure-web-sites
我在这里发布了 nuget 包。它基本上是一个.net程序集女巫
一切都很简单。
现在,当我将包添加到新的 VS2013 C# 项目时,它不会将标记添加到 app.config,这意味着它会在运行时崩溃,并显示“无法加载文件或程序集 'FSharp.Core,版本 = 4.0。 0.0 ...”消息。
如果添加手动添加标签,它会起作用。Add-BindingRedirect 命令也不做任何事情。显然它没有看到 FSharp.Core 的问题。
我究竟做错了什么?我应该在需要 FSharp.Core 标签的地方添加一个提示吗?
我正在尝试更新我的Diff All Files Visual Studio 扩展以支持 VS 2017。在调试我的扩展时,它抱怨找不到所需的程序集:
System.Windows.Markup.XamlParseException occurred
HResult=0x80131501
Message=Could not load file or assembly 'QuickConverter, PublicKeyToken=9c892aa7bc2af2cf' or one of its dependencies. The system cannot find the file specified.
Source=PresentationFramework
StackTrace:
at System.Windows.Markup.WpfXamlLoader.Load(XamlReader xamlReader, IXamlObjectWriterFactory writerFactory, Boolean skipJournaledProperties, Object rootObject, XamlObjectWriterSettings settings, Uri baseUri)
at System.Windows.Markup.WpfXamlLoader.LoadBaml(XamlReader xamlReader, Boolean skipJournaledProperties, Object rootObject, XamlAccessLevel accessLevel, Uri baseUri)
at System.Windows.Markup.XamlReader.LoadBaml(Stream stream, ParserContext parserContext, Object parent, Boolean closeStream)
at System.Windows.Application.LoadComponent(Object component, Uri resourceLocator)
at VS_DiffAllFiles.Sections.DiffAllFilesSectionControl.InitializeComponent() in D:\dev\Git\VS.DiffAllFiles\VS.DiffAllFiles.VS2017\obj\Debug\DiffAllFilesSectionControl.xaml:line 1
at VS_DiffAllFiles.Sections.DiffAllFilesSectionControl..ctor(DiffAllFilesSectionBase …Run Code Online (Sandbox Code Playgroud) 我正在尝试调试客户服务器 (Win 2012R2) 上的问题,其中我们的 .NET Web 应用程序之一托管在他们的 IIS(版本 8.5.9600.16384)中。最近,我们的一名技术支持人员更改了应用程序的 Web.config 文件中的一个较小的内部设置,根据他们的说法,没有对系统进行任何其他更改或操作。该应用程序也没有更新,之前一直在运行,没有任何问题。
由于该更改,配置站点的 AppPool 无法再启动。根据系统事件日志,有几次尝试启动,每次都导致工作进程崩溃,直到池的快速失败保护完全停止启动过程。
此外,由于我在客户的服务器上,我只有有限的调试选项。
WAS 在系统事件日志中报告:
为应用程序池“[我们的池]”提供服务的进程与 Windows 进程激活服务发生了致命的通信错误。进程 ID 是“5664”。数据字段包含错误编号。
由于在为该应用程序池提供服务的进程中出现一系列故障,应用程序池“[我们的池]”将被自动禁用。
查看相应的应用程序错误日志显示以下内容:
错误的应用程序名:w3wp.exe,版本:8.5.9600.16384,时间戳:0x52157ba0错误模块名称:PerfMon.dll,版本:8.0.10977.0,时间戳:0x59cfb424异常代码:0xc0000409错误偏移:0x000f8c7b出错进程ID:0x1620断裂作用应用程序启动时间:0x01d423ff75bef49f 错误应用程序路径:C:\Windows\SysWOW64\inetsrv\w3wp.exe 错误模块路径:C:\Program Files\Microsoft Monitoring Agent\Agent\APMDOTNETAgent\V8.0.10918.0\PerfMon.dll 报告 ID :b56327b3-8ff2-11e8-80d5-005056a52299 故障包全名: 故障包相关应用程序 ID:
在谷歌搜索这个问题时,我主要关注 PerfMon.dll 问题和提供的错误代码 0xc0000409,这显然与损坏的注册表项或堆栈缓冲区溢出有关,但在这两种情况下,我都无法弄清楚是什么原因可能是。
我还尝试了此处描述的故障转储分析 https://blogs.msdn.microsoft.com/parvez/2016/08/06/iis-application-pool-crash-and-debug-diag/
但最后似乎只是回到原始问题的往返,因为这是转储中发现的唯一错误:
微软公司的 C:\Program Files\Microsoft Monitoring Agent\Agent\APMDOTNETAgent\V8.0.10918.0\PerfMon.dll 中 PerfMon!DllGetClassObject+966fb 的汇编指令导致线程 2 出现未知异常(0xc0000409)
这基本上是我已经从事件日志中得到的。
我在这里的主要问题不仅是可能的原因和解决此问题的潜在方法,还包括如何首先正确找到原因/解决方案。
使用 Fusion Logs,我能够找到System.Web.DynamicData、System.Web.Extensions和System.ServiceModel.web 的三个绑定错误。
操作失败。绑定结果:hr = 0x80004005。未指明的错误
从以下位置加载的程序集管理器:>C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll 在可执行文件 C:\Windows\SysWOW64\inetsrv\w3wp.exe 下运行 --- 详细的错误日志如下。
=== 预绑定状态信息 === …
我正在开发一个运行PowerShell脚本的WPF应用程序.
string scriptPath = "/script/myscript.ps1";
Runspace runspace = RunspaceFactory.CreateRunspace();
runspace.Open();
Pipeline pipeline = runspace.CreatePipeline();
pipeline.Commands.AddScript(scriptPath);
Collection<PSObject> results = pipeline.Invoke();
Run Code Online (Sandbox Code Playgroud)
我添加了以下程序集.
C:\Program Files (x86)\Reference Assemblies\Microsoft\WindowsPowerShell\3.0\System.Management.Automation.dll
Run Code Online (Sandbox Code Playgroud)
但是当程序运行后出现异常;
无法加载文件或程序集'System.Management.Automation,Version = 3.0.0.0,Culture = neutral,PublicKeyToken = 31bf3856ad364e35'或其依赖项之一.强名称验证失败.(来自HRESULT的异常:0x8013141A)":"System.Management.Automation,Version = 3.0.0.0,Culture = neutral,PublicKeyToken = 31bf3856ad364e35"}**
当我搜索这个错误时,我可以找到一些答案.但那些对我来说并不清楚.请指教.
我们在运行时加载的引用dll上存在一些神秘版本不匹配的情况。
错误如:
无法加载文件或程序集X或其依赖项之一。找到的程序集的清单定义与程序集引用不匹配。(来自HRESULT的异常:0x80131040)
有什么方法可以调试程序集绑定。
换句话说,我如何知道有关已加载程序集的以下详细信息:
编译具有外部引用的 C# 项目时,引用的 dll 将被复制到项目的输出路径(exe 旁边)。
运行应用程序时,它期望找到 exe 旁边的 dll。
我正在寻找一种方法将我的 dll 文件分散到不同的目录(对于初学者来说是 Dlls)。并让 exe 在这些目录中查找 dll 文件。
例子:
假设我们有一个名为“App”的应用程序位于 下C:\App\App.exe,并且它使用了一个名为“App.dll”的 dll 文件,该文件当前也位于 下C:\App。
我希望创建一个名为的新目录C:\App\Dlls并将 App.dll 文件移动到那里,同时确保 App.exe 文件知道在新位置查找 dll。
我在网上搜索并找到了探测解决方案。这是我的代码(编辑后的“App.config”文件):
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.1" />
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas=microsoft-com:asm.v1">
<probing privatePath="Dlls" />
</assemblyBinding>
</runtime>
</configuration>
Run Code Online (Sandbox Code Playgroud)
我编译了我的应用程序,创建了 Dlls 目录并将所有 dll 文件移至该目录,但应用程序崩溃了。
我缺少什么?
assemblybinding ×13
c# ×8
.net ×7
nuget ×2
web-config ×2
asp.net ×1
assemblies ×1
autofac ×1
azure ×1
binding ×1
clr ×1
dll ×1
iis ×1
loadlibrary ×1
perfmon ×1
powershell ×1
probing ×1
wpf ×1