Sharepoint学习笔记—习题系列--70-576习题解析 -(Q19-Q20)
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.
解析:
本题需要你创建一个包含有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类似,都要涉及到全局程序集缓存,所以也必然被排除了。
因此本题答案应该选 D
参考
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).aspx
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中添加新的操作,只是围绕着如何通过修改版本属性来影响升级,所以也应该被排除。
因此本题答案应该选 B
参考
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).aspx
Sharepoint学习笔记—习题系列--70-576习题解析 -(Q19-Q20)的更多相关文章
- Sharepoint学习笔记—ECM系列—文档列表的Metedata Navigation与Key Filter功能的实现
如果一个文档列表中存放了成百上千的文档,想要快速的找到你想要的还真不是件容易的事,Sharepoint提供了Metedata Navigation与Key Filter功能可以帮助我们快速的过滤和定位 ...
- Sharepoint学习笔记—ECM系列--文档集(Document Set)的实现
文档集是 SharePoint Server 2010 中的一项新功能,它使组织能够管理单个可交付文档或工作产品(可包含多个文档或文件).文档集是特殊类型的文件夹,它合并了唯一的文档集属性以及文件夹和 ...
- Sharepoint学习笔记—习题系列--70-576习题解析 --索引目录
Sharepoint学习笔记—习题系列--70-576习题解析 为便于查阅,这里整理并列出了70-576习题解析系列的所有问题,有些内容可能会在以后更新. 需要事先申明的是: 1. ...
- Sharepoint学习笔记—习题系列--70-573习题解析 --索引目录
Sharepoint学习笔记—习题系列--70-573习题解析 为便于查阅,这里整理并列出了我前面播客中的关于70-573习题解析系列的所有问题,有些内容可能会在以后更新, ...
- Deep Learning(深度学习)学习笔记整理系列之(五)
Deep Learning(深度学习)学习笔记整理系列 zouxy09@qq.com http://blog.csdn.net/zouxy09 作者:Zouxy version 1.0 2013-04 ...
- Deep Learning(深度学习)学习笔记整理系列之(八)
Deep Learning(深度学习)学习笔记整理系列 zouxy09@qq.com http://blog.csdn.net/zouxy09 作者:Zouxy version 1.0 2013-04 ...
- Deep Learning(深度学习)学习笔记整理系列之(七)
Deep Learning(深度学习)学习笔记整理系列 zouxy09@qq.com http://blog.csdn.net/zouxy09 作者:Zouxy version 1.0 2013-04 ...
- Deep Learning(深度学习)学习笔记整理系列之(六)
Deep Learning(深度学习)学习笔记整理系列 zouxy09@qq.com http://blog.csdn.net/zouxy09 作者:Zouxy version 1.0 2013-04 ...
- Deep Learning(深度学习)学习笔记整理系列之(四)
Deep Learning(深度学习)学习笔记整理系列 zouxy09@qq.com http://blog.csdn.net/zouxy09 作者:Zouxy version 1.0 2013-04 ...
- Deep Learning(深度学习)学习笔记整理系列之(三)
Deep Learning(深度学习)学习笔记整理系列 zouxy09@qq.com http://blog.csdn.net/zouxy09 作者:Zouxy version 1.0 2013-04 ...
随机推荐
- Nodejs学习笔记(三)——一张图看懂Nodejs建站
前言:一条线,竖着放,如果做不到精进至深,那就旋转90°,至少也图个幅度宽广. 通俗解释上面的胡言乱语:还没学会爬,就学起走了?! 继上篇<Nodejs学习笔记(二)——Eclipse中运行调试 ...
- 使用 CSS3 实现 3D 图片滑块效果【附源码下载】
使用 CSS3 的3D变换特性,我们可以通过让元素在三维空间中变换来实现一些新奇的效果. 这篇文章分享的这款 jQuery 立体图片滑块插件,利用了 3D transforms(变换)属性来实现多种不 ...
- 你真的精通 CSS 了?来挑战一下 CSS 选择器测验吧
CSS 选择器赋予 CSS 强大的 HTML 元素匹配功能.作为前端开发人员必须要掌握的一部分,可能基本的大家都知道.但是你真的精通 CSS 了吗?挑战一下 CSS 选择器测验就知道. 您可能感兴趣的 ...
- Linux菜鸟级重点
这是本人自学Linux所做的笔记,以及实现一些功能作的总结.乐意与各位喜欢linux的朋友交流学习,共同进步.这篇文章只是简单介绍一些linux比较常用的或者说是最基础的也是最重要的知识,有些在模块后 ...
- QT学习笔记3
对话框 新建了一个对话框,在新建项目选择类型时是Dialog即可. 添加的代码如下,注意QCheckBox 并没有添加头文件定义,只是加了类的前向声明.因为我们仅仅使用的是指针,并不涉及到这些类的函数 ...
- 基于HT for Web的3D拓扑树的实现
在HT for Web中2D和3D应用都支持树状结构数据的展示,展现效果各异,2D上的树状结构在展现层级关系明显,但是如果数据量大的话,看起来就没那么直观,找到指定的节点比较困难,而3D上的树状结构在 ...
- .NET Core扩展IServiceCollection自动注册服务
前言 在ASP.NET Core中使用依赖注入中使用很简单,只需在Startup类的ConfigureServices()方法中,通过IServiceCollection接口进行注入即可,其它的无需关 ...
- 玩爽了!直接在Chrome里抓取数据
一个小测试发现可以自动做题,于是想通过脚本的方式看能不能获取相应的题库,刚好可以学习一下JS异步操作.花了一天时间,总算跑顺利了,遇到了不少坑.记录下来分享. 1.JS如何顺序执行 JS有强大的异步操 ...
- LeetCode - Convert Sorted Array to Binary Search Tree
题目: Given an array where elements are sorted in ascending order, convert it to a height balanced BST ...
- ASP.NET MVC系列:从Controller访问Model数据
在项目解决方案中,添加一个MoviesController控制器,选择对应的模板,和模型类以及数据上下文:关于如何添加模型类和数据上下文,我们在ASP.NET MVC系列:添加模型中已经介绍过