简体   繁体   English

GAC和\\ Inetpub \\ wwwroot \\ bin中都需要ASP.NET DLL

[英]ASP.NET DLL required in both GAC and \Inetpub\wwwroot\bin

I copied an ASP.NET application DLL into \\Inetpub\\wwwroot\\bin and copied the application folder under Sharepoint 2007 TEMPLATES\\Layouts folder, so I could access the application from http://sp-portal/sites/sitecoll123/_layouts/aspnetapp/Default.aspx . 我将ASP.NET应用程序DLL复制到\\ Inetpub \\ wwwroot \\ bin并复制了Sharepoint 2007 TEMPLATES \\ Layouts文件夹下的应用程序文件夹,因此可以从http://sp-portal/sites/sitecoll123/_layouts/aspnetapp/Default.aspx访问该应用程序http://sp-portal/sites/sitecoll123/_layouts/aspnetapp/Default.aspx It complained that: 它抱怨说:

Request for the permission of type 'System.Data.SqlClient.SqlClientPermission, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed. at System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet)

I then installed the DLL to the GAC (after removing it from the \\inetpub\\wwwroot\\bin folder) and it could not load the DLL. 然后,我将DLL安装到了GAC中(从\\ inetpub \\ wwwroot \\ bin文件夹中删除了它),但它无法加载DLL。 It complained that: 它抱怨说:

Could not load type 'AppNS.Default'. at System.Web.UI.TemplateParser.GetType(String typeName, Boolean ignoreCase, Boolean throwOnError)

Then, I copied back the DLL into \\Inetpub\\wwwroot\\bin, while still leaving the assembly installed in the GAC as well. 然后,我将DLL复制回\\ Inetpub \\ wwwroot \\ bin,同时仍将程序集安装在GAC中。 Only then it worked! 只有这样,它才有效! I cannot explain this... I thought having it in the GAC is the quick and dirty way of getting the assembly to be accessible easily. 我无法解释这一点...我认为在GAC中拥有它是使组件易于访问的快速而肮脏的方法。 Why does it need to be in both places? 为什么两个地方都需要它? This is an ASP.NET 3.5 application installed under _layouts in Sharepoint/MOSS 2007. 这是安装在Sharepoint / MOSS 2007中_layouts下的ASP.NET 3.5应用程序。

<%@ Assembly Name="AppNS, Version=1.0.0.0,Culture=neutral,PublicKeyToken=d5e3267159f21fb6" %>

was missing in the Default.aspx as well as in a page control (ASCX), which was needed to reference the assembly installed in the GAC. 在Default.aspx和页面控件(ASCX)中丢失了,该控件需要引用安装在GAC中的程序集。 After adding this line in both files, I was able to delete the DLL from \\Inetpub\\wwwroot\\bin and still have a functional application. 在两个文件中都添加了这一行之后,我能够从\\ Inetpub \\ wwwroot \\ bin中删除DLL,并且仍然具有正常的应用程序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM