将SharePoint布局ASP .NET程序集部署到GAC中 [英] Deploying SharePoint layout ASP .NET assembly into GAC
问题描述
我当前正在重写旧版SharePoint应用程序,我需要弄清楚如何部署它.
该应用程序本身是具有多种功能的SharePoint解决方案,包括Webparts和带有某些代码的简单网页.
I'm currently rewriting a legacy SharePoint application and I need to figure out how to deploy it.
The application itself is SharePoint solution with several features, including webparts and simple web pages with some code.
有一个网页旨在部署在layouts
子文件夹中.
在生产环境中,layouts
子目录中没有代码隐藏,只有.aspx
文件.
There is a webpage that is designed to be deployed in layouts
subfolder.
In production environment, there is no codebehind in layouts
subdirectory, just the .aspx
file.
我知道从GAC加载了相应的代码隐藏程序集.确实存在.
但是,页面代码不包含会要求其在GAC中显示的<%@ Assembly %>
指令,也不指定完全限定的名称:
I understand that corresponding codebehind assembly is loaded from GAC. Indeed, it is there.
However the page code doesn't contain <%@ Assembly %>
directive that would ask it look in GAC, nor does it specify fully-qualified name:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="BadWolf._Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<!-- -->
</html>
那么此页面如何在生产环境中定位其代码汇编?我需要将相同的代码部署到其他服务器上,但是如果我未指定<%@ Assembly %>
SharePoint会给我带来未知错误,在日志中表示如下:
So how does this page locate its code assembly in the production environment? I need to deploy the same code to a different server but if I don't specify <%@ Assembly %>
SharePoint gives me Unknown Error, which is represented in logs as follows:
Exception Type: System.Web.HttpException
Exception Message: Could not load type 'BadWolf._Default'.
我想念什么?是否有任何特殊的配置,任何特殊的设置?
What did I miss? Is there any special config, any special setting, whatever?
推荐答案
原来该程序集位于SharePoint bin
文件夹中,这就是为什么在不指定标准名称的情况下加载该程序集的原因. 但是从GAC中删除它又产生了另一个问题:
Turned out the assembly was in SharePoint bin
folder, that's why it was loaded without specifying the fully qualified name. However removing it from GAC yielded another issue:
请求类型为"Microsoft.SharePoint.Security.SharePointPermission,Microsoft.SharePoint.Security,Version = 12.0.0.0,Culture = neutral,PublicKeyToken = 71e9bce111e9429c"的权限失败
Request for the permission of type 'Microsoft.SharePoint.Security.SharePointPermission, Microsoft.SharePoint.Security, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' failed
这很有趣,因为从GAC或bin
文件夹中删除该程序集使其无法使用(或需要我不寻求的其他配置),并且我不确定实际上是在加载哪个程序./strong>
This is funny because removing the assembly from either GAC or bin
folder makes it unusable (or else requiring additional configuration which I seek not), and I'm not sure which one is actually being loaded.
我认为我会坚持在GAC中保留程序集(以获得完全信任)并指定完全限定的名称.
I think I'll stick with keeping assembly in GAC (to have full trust) and specifying fully qualified name.
这篇关于将SharePoint布局ASP .NET程序集部署到GAC中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!