Question 19
You are designing a custom SharePoint 2010 solution package. It will include a feature that contains a Web Part,which requires a custom assembly for its functionality. You need to design the feature based on the following requirements:
.The Web Part must be a partial trust application and support a custom Code Access Security (CAS) policy.
.The solution package must be deployed without the need of farm-level administrator permissions.
Which approach should you recommend?
A. Create the Web Part feature and deploy the required assembly to the bin directory of only the Web applications that require it. Then delegate administration to the site administrator. Lastly, create a custom CAS policy file and point to it the web.config file of the application.
B. Create the Web Part feature assembly with a strong name and deploy it using a .wsp file to the _app_bin directory of all Web applications where it is needed. Then activate it using delegated administration.
C. Create an assembly with a strong name and deploy it to the global assembly cache at the farm level. Activate the feature at the site collection level with delegated administration.
D. Create the Web Part feature as a sandboxed solution.web
解析:
本题须要你建立一个包含有WebPart的解决方案,此Webpart须要基于客户定义的程序集实现其功能。解决方案须要知足以下条件:
要求1. 此WebPart必须实现的是部分信任的应用,并支持代码访问安全性策略(CAS)
要求2.此解决方案不须要场管理员的支持就能部署。
看到上面的要求,尤为是第2个要求,立刻就应该反应出SandBox Solution了。本题的备选项只有选项D使用了沙盒方案,因此应该是选项D。
可是咱们仍是须要过一遍其它备选项以确定咱们的判断:
选项 A. Create the Web Part feature and deploy the required assembly to the bin directory of only the Web applications that require it. Then delegate administration to the site administrator. Lastly, create a custom CAS policy file and point to it the web.config file of the application.
本选项把WebPart部署到Bin目录,咱们来了解下这种状况。
在 SharePoint 网站内,能够将 Web 部件程序集部署到多个位置。
1.解决方案库 – 解决方案库是使用沙盒解决方案部署 Web 部件时的建议位置。默认状况下,它为 Web 部件提供监视和安全性。
2. bin 目录 — bin 目录是一个存储在 Web 应用程序根目录下的文件夹。在 Internet Information Services (IIS) 中建立网站时将肯定此文件夹的位置。在 SharePoint Foundation 中,能够经过管理中心网站或经过在 IIS 管理器中手动建立新网站来实现此目的。
重要信息:若是 bin 目录不存在,您必须手动添加一个 bin 目录。请不要在本地 _app_bin 目录中存储 Web 部件,此目录是专为 Microsoft 保留的。
3.全局程序集缓存 — 可用于部署已签名程序集的全局位置。利用全局程序集缓存,能够跨多个应用程序共享程序集。全局程序集缓存将随 .NET 运行库一块儿自动安装。一般,组件将存储在 C:\WINNT\Assembly 文件夹中。
其中,针对本选项所采起的第2种方式即bin目录方式,其优势是:默认状况下,程序集以部分信任的形式运行。从该目录运行的代码具备较低级别的代码访问安全性 (CAS) 权限。因为管理员必须明确提高已向 Web 部件授予的权限以使该部件可以正常运行,所以他们一般更愿意程序集在 bin 目录中经过已知的必需 CAS 权限集运行。每一个 Web 应用程序都有一个 bin 目录。这样,就能够隔离特定 Web 应用程序的代码。但缺点是:为了使此 Web 部件可以在多个 Web 应用程序中运行,您必须将此 Web 部件部署到全局程序集缓存中。【这句就是破解本选项的要点,既然要求部署到全局程序集缓存中,那就不可能脱离场管理员的支持了】缓存
选项B. Create the Web Part feature assembly with a strong name and deploy it using a .wsp file to the _app_bin directory of all Web applications where it is needed. Then activate it using delegated administration.
此选项就更直接,咱们来看看微软的说明:” Web 部件程序集能够安装在 Web 应用程序的 bin 目录或全局程序集缓存中,若是 bin 目录不存在,您必须手动添加一个 bin 目录。请不要在本地 _app_bin 目录中存储 Web 部件,此目录是专为 Microsoft 保留的。” 因此仅就这一句就能够排除本选项了。安全
选项C. Create an assembly with a strong name and deploy it to the global assembly cache at the farm level. Activate the feature at the site collection level with delegated administration.
本选项也与选项A相似,都要涉及到全局程序集缓存,因此也必然被排除了。服务器
所以本题答案应该选 Dapp
参考
http://msdn.microsoft.com/zh-cn/library/ff798425.aspx
http://msdn.microsoft.com/zh-cn/library/cc768621(v=office.14).aspx
http://msdn.microsoft.com/zh-cn/library/bb815365(v=office.12).aspxide
Question 20
A SharePoint 2010 server farm has a custom feature installed that provides specialized business logic for a SharePoint solution package. The solution package is being updated to include additional functionality. Your job isto specify a deployment method for the updates that will:
.Add the additional application business logic to the solution package.
.Provide the least downtime for the application.
.Automate the application upgrade a much as possible.
You need to update the solution package with additional business logic and meet all these requirements. Which
approach should you recommend?
A. Create a new feature containing the new business logic. Use the feature upgrade process to deploy the solution package by incrementing the version number of the feature in the Feature.xml file.
B. Add the new business logic to the existing feature. Use the feature upgrade process to deploy the solution package by incrementing the version number of the feature in the Feature.xml file.
C. Use Visual Studio 2010 to add the new business logic to the existing code in the .wsp package for the feature. Create two timer jobs - one to retract the current solution package and one to deploy the solution package with
the updated feature.
D. Use the object model to create a custom feature receiver to increment the version property of the SPFeatureDefinition class. Increment the version number of the current solution in the Feature.xml file.布局
解析:
本题题意是你的服务器场中已经包含了某个功能,此功能是经过一个方案包部署到场中的。如今,你须要在这个原有的功能中加入更多的操做,而后经过更新升级那个原有的方案包以替换成新的这个具备更多操做的功能。要求是:
要求1. 新的操做逻辑应该被添加到解决方案包中
要求2 尽可能减小已有方案的停用时间
要求3. 升级操做尽能够自动化
咱们先来回顾一下Sharepoint关于Feature升级的部分:
在 Microsoft SharePoint Foundation 中,每一个功能(Feature)都具备一个在与其对应的 Feature.xml 文件中指定的版本号。在某个特定范围内激活一个功能时,会建立一个与该功能的版本关联的功能实例。利用 SharePoint Foundation 中的功能版本控制,可轻松跟踪功能及其关联实例。以后,当您部署新版本的功能时,SharePoint Foundation 检测到关联的功能也须要进行升级,由于功能实例的版本号小于当前的 Feature.xml 文件中指定的新版本号。
注释: 最佳作法是,决不将 FEATURES 文件夹中的功能文件与解决方案部署文件或解决方案升级文件分开放置,由于功能升级是一个高级部署选项,它不会在部署期间验证功能 XML。
在运行功能升级时,还会根据新 Feature.xml 文件中指定的升级操做对须要升级的功能实例进行升级。
接下来分析各备选项:
选项A. Create a new feature containing the new business logic. Use the feature upgrade process to deploy the solution package by incrementing the version number of the feature in the Feature.xml file.
此选项是从新建立一个新的Feature,这显然不符合在原有Feature的基础上进行升级的要求。并且如上面描述:决不将 FEATURES 文件夹中的功能文件与解决方案部署文件或解决方案升级文件分开放置。另外一个层面,你不须要从新定义一个新的Feature来实现升级。因此本选项应该被排除。
选项B. Add the new business logic to the existing feature. Use the feature upgrade process to deploy the solution package by incrementing the version number of the feature in the Feature.xml file.
在已有的Feature代码中添加新的操做,而后经过Feature升级的相关处理以替换更新原有的Feature。符合上面Feature升级描述。网站
选项C. Use Visual Studio 2010 to add the new business logic to the existing code in the .wsp package for the feature. Create two timer jobs - one to retract the current solution package and one to deploy the solution package with the updated feature.
本选项试图在VS2010中修改wsp包的代码,向其中添加新的操做逻辑。咱们知道,所谓wsp包就是解决方案包, 是一个分发包,可将您的 SharePoint Foundation 2010 自定义开发工做成果分发到服务器场中的 Web 服务器或应用程序服务器。使用解决方案可打包和部署自定义功能、网站定义、模板、布局页、Web 部件、级联样式表和程序集。解决方案包是一个扩展名为 .wsp 的 CAB 文件和一个指令清单文件。能够打包到解决方案中的组件包括:
1 .NET Framework 程序集,一般是 Web 部件程序集和事件接收器程序集。
2.部署文件,例如资源文件、网页或其余帮助程序文件。
3.功能,使您可以激活和停用网站中的代码,并提供包括自定义列表、库、字段和内容类型等元素的功能。
4.新的模板和网站定义。
5.必须在 Web 服务器级别执行的配置,例如,将自定义项部署到 Web.config 文件,以用于注册 Web 部件。您还可使用随功能分发的功能修改这些配置。
6.被称为网页的 Web 内容(如网页和图像)。若是您必须在断开链接的环境中部署 Web 内容,应该使用内容部署包。
Sharepoint支持建立和部署自定义 Web 部件解决方案包。
本题的目标是,你须要添加新的操做逻辑去升级原有的Feature,所以,本选项的局限在于:1.经过直接修改wsp包的代码是没法添加新的操做逻辑的,由于这些操做逻辑很大程度上是须要被从新编译的,而这样一来,就须要从新生成wsp包,而不只仅是修改其内部的代码来直接达到。2. 仅添加新的business logic并无解决如何对Feature进行升级的操做。而至于后续的timer jobs也只是去完成wsp包的卸载与从新安装部署,咱们固然能够经过Replacements 方式去升级一个Solution,但这种方式必需要重启咱们的IIS,由此会形成downtime时间,这也是本题所不想要的。因此,本选项也应该被排除。
选项D. Use the object model to create a custom feature receiver to increment the version property of the SPFeatureDefinition class. Increment the version number of the current solution in the Feature.xml file.
本选项没有解决向原有Feature中添加新的操做,只是围绕着如何经过修改版本属性来影响升级,因此也应该被排除。
所以本题答案应该选 Bui
参考
http://msdn.microsoft.com/zh-cn/library/ee535723(v=office.14).aspx
http://technet.microsoft.com/zh-cn/library/ff607688(v=office.14).aspx
http://msdn.microsoft.com/zh-cn/library/aa544500.aspx
http://msdn.microsoft.com/zh-cn/library/ee535708(v=office.14).aspxspa