为什么AssemblyResolver即使在加载dll(manualy)时也会触发?(Why AssemblyResolver fire even when dll is loaded (manualy)?)
我有2个项目的C#解决方案:
- DLLTest(控制台应用)
- BLib(图书馆)
在DLLTest中,我设置了对BLib的引用,并将Copy Local属性设置为false。
编译解决方案。
将BLib.dll复制到'C:\ BLib.dll'并运行应用程序。
在我的代码的第一步,我从路径'C:\ BLib.dll'加载程序集,然后从那里调用方法。 在从BLib程序集调用方法时触发AssemblyResolver并尝试加载我手动加载的程序集。我可以做一些应用程序,知道库已经加载,而不是尝试再次加载它?
这是来自BLib项目的BClass.cs文件:using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace BLib { public class BClass { public static void PrintName() { Console.WriteLine("BLib"); } } }
这是DLLTest项目的Program.cs文件:
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Reflection; namespace DLLTest { class Program { static void Main(string[] args) { AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve; Assembly.LoadFile(@"C:\BLib.dll"); Console.WriteLine("Loaded assembles:"); AppDomain.CurrentDomain.GetAssemblies().ToList() .ForEach(p => Console.WriteLine(p)); Console.WriteLine("End list of assembles"); try { PrintMessage(); } catch(Exception ex) { Console.WriteLine(ex.Message); } Console.ReadKey(); } private static void PrintMessage() { BLib.BClass.PrintName(); } private static Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args) { Console.WriteLine(args.Name); return null; } } }
I have C# solution with 2 project:
- DLLTest (Console app)
- BLib (library)
In DLLTest I set reference to BLib and set Copy Local property to false.
Compile solution.
Copy BLib.dll to 'C:\BLib.dll' and run application.
In first step in my code I load Assembly from path 'C:\BLib.dll' then invoke method from there. On invoking method from BLib assembly fire AssemblyResolver and try load assembly which I loaded before manually.Can I do something that application to know that the library has already been loaded and not try load it again?
This is BClass.cs file from BLib project:using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace BLib { public class BClass { public static void PrintName() { Console.WriteLine("BLib"); } } }
This is Program.cs file from DLLTest project:
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Reflection; namespace DLLTest { class Program { static void Main(string[] args) { AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve; Assembly.LoadFile(@"C:\BLib.dll"); Console.WriteLine("Loaded assembles:"); AppDomain.CurrentDomain.GetAssemblies().ToList() .ForEach(p => Console.WriteLine(p)); Console.WriteLine("End list of assembles"); try { PrintMessage(); } catch(Exception ex) { Console.WriteLine(ex.Message); } Console.ReadKey(); } private static void PrintMessage() { BLib.BClass.PrintName(); } private static Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args) { Console.WriteLine(args.Name); return null; } } }
原文:https://stackoverflow.com/questions/32178367
最满意答案
这完全取决于你登录的内容。 这两个选项都是可行的,使用AOL / Google登录的依赖方决定如何处理/连接帐户。
That totally depends on what you're signing in to. Both options are feasible and the Relying Party that uses AOL/Google for login decides how the accounts are treated/connected.
相关问答
更多-
OpenID Connect 仅支持根据您提供的某些提示(电子邮件,帐户,URL,域名等) 查找您的提供商的发现 ; 它不会为您提供持久标识符,您可以将身份验证委派给您选择的可配置提供程序。 因此,如果您只想使用自定义URI来查找您的提供者,则可以使用Nat给出的方法(除了Google没有做和不能做的最后一点,并假设SO支持发现)。 但是如果你想要真正的委托,那么RP可以使用由OP返回的标识符,这个标识符在你委派的不同的OP上是持久的,那么你不能。 对于StackOverflow,您可能不需要以下任何一种: ...
-
这完全取决于你登录的内容。 这两个选项都是可行的,使用AOL / Google登录的依赖方决定如何处理/连接帐户。 That totally depends on what you're signing in to. Both options are feasible and the Relying Party that uses AOL/Google for login decides how the accounts are treated/connected.
-
唯一不同的是。 OpenID Connect和OAuth 2.0之间的授权请求确实是“范围”参数的内容。 OpenID Connect构建于OAuth之上。 触发OpenID Connect流的方法是在授权请求中包含“openid”范围。 OpenID Connect是一种标准化的SSO协议,由各种提供商实施。 不幸的是,LinkedIn还不支持它,请参阅: LinkedIn OpenID Connect提供商吗? 如何与AWS Cognito联合身份一起使用? The only difference wr ...
-
OpenID Connect是否标准化OAuth 2授权端点?(Does OpenID Connect standardize the OAuth 2 Authorization Endpoint?)[2022-04-11]
不,不。 但它做了什么,是指定如何 发现正确端点的URL,使用: GET /.well-known/openid-configuration HTTP/1.1 然后选择authorization_endpoint 。 这里和这里有两个真实世界的例子。 No it doesn't. But what it does do, is specify how to discover the URL of the correct endpoint, using: GET /.well-known/openid-co ... -
OpenId提供商(OpenId providers)[2023-02-09]
学术界的标准开源AIM产品是Shibboleth( http://shibboleth.net/ )。 它是一种成熟而强大的产品,在世界各地都在使用。 它通常使用SAML,但有一个OpenID扩展。 https://wiki.shibboleth.net/confluence/display/SHIB2/IdP+OpenID+Configuration 但是我会警告你,配置可能是一件苦差事。 我自己没有使用OpenID扩展。 The standard open source AIM product in a ... -
OpenID Connect Providers是否加密然后签署他们的JWT?(Do OpenID Connect Providers encrypt then sign their JWTs?)[2022-11-21]
使用/如果使用加密,Connect OP将始终签名,然后加密,如果他们遵循规范。 OpenID Connect Core第2部分说:“如果ID令牌被加密,它必须被签名然后加密”。 第16.14节,签名和加密顺序稍微详细地说了同样的事情。 When/if encryption is used, Connect OPs will always sign and then encrypt, if they are following the specification. Section 2 of OpenID C ... -
不推荐使用OpenID代替OpenID Connect。 OAuth 2.0用于授权访问API的应用程序。 所以,使用OpenID Connect。 要使用accounts.xyz.com登录,您需要实现自己的OpenID Connect Provider或其他一些身份验证方法。 OpenID is deprecated in lieu of OpenID Connect. OAuth 2.0 is for delegation to an Application for accessing of APIs ...
-
是的,Google Identity Toolkit支持OpenID Connect(适用于Google身份提供商)。 虽然Google Identity Toolkit尚未支持Twitter,但我们正在努力添加此类功能并希望尽快推出 - 请继续关注:) 根据你关于AppEngine的OpenID Connect支持的问题,我的理解是目前没有(目前只支持OpenID 2.0,请参阅AppEngine dev文档 )。 希望有所帮助! Yes, Google Identity Toolkit supports ...
-
OpenID,有多开放?(OpenID, how open is it?)[2023-08-07]
OpenID是一个开放的规范。 它定义了提供者和消费者之间的接口,它在所有提供者和所有消费者之间是相同的[1]。 这不是关于将您的雅虎身份与您的Google身份相关联,而是让您通过许多其他网站(作为消费者)的任何[2]您的OpenID身份(雅虎,谷歌等作为提供商)来识别自己,而不是创建新用户 - 记住并记住许多密码。 雅虎和谷歌都是提供商(而不是消费者)。 [1]几乎相同,因为它们可能支持额外的扩展。 [2]或者可选择一些。 OpenID is an open specification. It defin ... -
我能够找到的唯一允许使用范围“openid”(据我所知的那样需要)的是以下内容,它们都给出了如何设置它的详细步骤,我已使用java客户端验证: 销售队伍: https://developer.salesforce.com/page/Inside_OpenID_Connect_on_Force.com 谷歌: https://developers.google.com/accounts/docs/OAuth2Login#sendauthrequest eBay - 奥利奥项目 - 非常“原始”,并没有真正与e ...