Sharepoint学习笔记—习题系列--70-576习题解析 -(Q147-Q151)

Question  147
 Your company has an existing SharePoint 2010 public-facing Web site. The Web site runs on multiple loadbalanced Web front-ends. Your company recently changed its name. You are asked to design a plan to update the Web site content to reflect the company name change. You need to accomplish this with a minimum amount of developer hours and minimum impact on users. Which approach should you recommend?
A. Create a Power Shell script to iterate through the site content and make the updates as needed.
B. Create a custom delegate control with the new company name and copy it to the \14\Config directory of all Web front-end servers. Perform an IISReset on each Web front-end server.
C. Create a custom application page with the new company name and copy it to the _layouts directory of all Web front-end servers.
D. Add a property in the web.config file to store the company name. Then update the master pages and page layouts to return the name from that property.

解析:
 你公司有一个Sharepoint2010公共网站,此网站采用了若干个负载均衡的WFE服务器。你公司现在更改了公司名称,因此,你需要采用尽可能少的开发以及减少尽可能有的冲击来完成对网站内涉及到公司名称的内容的更改。你该如何操作呢?
  我们知道,只要重启了IIS,那么Sharepoint网站就会暂时停运,用户就会访问不到Sharepoint网站,这样的冲击肯定不是本题所要的。而选项B与选项D均需要重启IIS。其中选项D虽然是修改了Web.config文件,但我们知道,要想使此文件的修改生效,往往就需要重启IIS。所以选项B.D可以直接排除。
  而选项C则试图通过创建一个新应用程序页面来解决本题的问题,这显然是两码事,本题主要是想要你修改已经存在的网站内容,而非使用新的公司名称创建新内容。所以选项C也应被排除。
  选项A,可以通过PowerShell代码段来遍历Sharepoint内对象并作相应的更改,又不用重启IIS。
因此本题答案应该选  A

参考 
http://msdn.microsoft.com/en-us/library/ee536539(v=office.14).aspx
http://msdn.microsoft.com/en-us/library/aa979592(v=office.14).aspx

 

Question  148
 You have a public-facing SharePoint 2010 site. The site resides on two Web front-ends that are not load balanced. You are asked to design an update for a Web Part to the site. The update requires modifications to the code in the global assembly cache (GAC). You need to design the update with minimal impact to users who are accessing the site. Which approach should you recommend?
A. Deploy the update directly to the GAC. Perform an IISReset on each Web front-end.
B. Deploy the update directly to the GAC. Recycle the application pool for the SharePoint site on each Web frontend.
C. Deploy the update within a custom Microsoft Windows Installer package that copies the code into the GAC and performs an IISReset on each Web front-end.
D. Deploy the update in a SharePoint solution file.


解析:
   你公司有一个Sharepoint2010公共网站,此网站运行在两台未采用负载均衡的WFE服务器上。你现在需要升级网站内的某个Web Part,此升级涉及到对部署在GAC内的某个程序集代码的修改,并要求尽量减少对网站的冲击,你该如何操作呢?
   我们知道:负载均衡建立在现有网络结构之上,在负载均衡的思路下,多台服务器为对称方式,每台服务器都具有同等的地位,可以单独对外提供服务而无须其他服务器的辅助。通过负载分担技术,将外部发送来的请求按一定规则分配到对称结构中的某一台服务器上,而接收到请求的服务器都独立回应客户机的请求。通过应用负载均衡技术,使应用服务超过了一台服务器只能为有限用户提供服务的限制,可以利用多台服务器同时为大量用户提供服务。当某台服务器出现故障时,负载均衡服务器会自动进行检测并停止将服务请求分发至该服务器,而由其他工作正常的服务器继续提供服务,从而保证了服务的可靠性。【也就是说,这里所描述的情况在本题就无法产生作用了,我们必须要人为介入去降低Web Part的升级对各个WFE服务器的冲击】
首先,如果采用IISReset的操作,那么就会造成整个Sharepoint网站停止服务。这是因为,IISReset会强制停止所有的进程并重新启动它们,通过这种方式以保证所有的更改都在重新启动后生效。当然,这种冲击是最大的,所以可以直接排除选项A.C。
    至于应用程序池回收(Recycle the application pool),我们知道应用程序池是将一个或多个应用程序链接到一个或多个工作进程集合的配置。因为应用程序池中的应用程序与其他应用程序被工作进程边界分隔,所以某个应用程序池中的应用程序不会受到其他应用程序池中应用程序所产生的问题的影响。Sharepoint网站是基于Web Application的,而Web Application是运行在Application Pool的。如果回收程序池,系统就会开启一个新的进程,而新版本的DLLs就会从GAC中重新加载【针对本题就意味着新版本的Web Part的程序集重新加载】。 所以,选项B是本题正解。
至于选项D.开发并部署Sharepoint解决方案。我们知道,这种方法也会重新启动IIS,所以也被排除。下面是Sharepoint场解决方案部署步骤的详细信息:
服务器场解决方案的部署步骤将创建一个计时器作业。此计时器作业由服务器场中的每台 Web 服务器上的计时器服务使用。此计时器作业还使用 SharePoint Foundation 管理 Web 服务来访问相应权限以将解决方案文件部署到每台计算机,因此所有服务器上必须同时运行这两项服务,部署才能成功。首先,分析包清单以查找程序集、应用程序页、JavaScript 以及其他不属于功能的文件。将这些项复制到清单中指定的位置。将功能中包含的所有文件复制到 Feature 目录(%ProgramFiles%\Common Files\Microsoft Shared\web server extensions\14\TEMPLATE\FEATURES 的子目录)。在将解决方案文件复制到目标计算机后,将为所有前端 Web 服务器安排配置重置;之后,重置过程将部署文件并重新启动 Microsoft Internet Information Services (IIS)【此处是相关描述】。服务器场管理员可指定执行此操作的时间。最后,注册服务器场解决方案功能,并将架构和定义文件提交到配置存储区。

因此本题答案应该选 B

参考 
http://www.51testing.com/?uid-43726-action-viewspace-itemid-92693
http://blogs.msdn.com/b/dtaylor/archive/2011/02/23/sharepoint-2010-service-application-load-balancer.aspx
http://msdn.microsoft.com/zh-cn/library/ms525803(v=vs.90).aspx
http://msdn.microsoft.com/zh-cn/library/aa544500(office.14).aspx


Question  149
 You have multiple SharePoint 2010 sites based on the same site definition. You need to plan a strategy to update the property value for a Web Part specified in the site definition for all existing sites. You must accomplish this with a minimum of developer hours. Which strategy should you recommend?
A. Update the site definition to specify the new property for the Web Part and deploy it through a feature to each of the sites.
B. Create a delegate control with the updated value and deploy it through a feature to each of the sites.
C. Copy an update to the Web Part into the global assembly cache (GAC) and perform an IISReset.
D. Use a Power Shell script to iterate through the sites and update the property.


解析:
  你基于某个网站定义创建了若干个Sharepoint网站,你现在想要对网站定义内的某个Web Part的属性值进行更改,并将此更改应用到所有的相关网站,要求尽量少的开发工作,你该如何操作呢?
  首先,我们知道,如果根据网站定义创建了网站,你通常就不能再通过修改网站定义来更改那些已经创建的网站了。Sharepoint提供了Feature Stapling来在不修改原有网站定义的情况下对已存在的网站进行功能扩充,但通过此方式就需要创建项目并进行开发了。然而由于本题仅涉及Web Part的属性更改,没涉及其功能的升级,所以我们就可以借助PowerShell来做到这点。下面是样例代码:

$site = Get-SPSite "SiteCollectionURL"
$webcoll = $site.AllWebs
 #Step through each web in site collection
foreach ($web in $webcoll) {
#Get the root folder
$folder = $web.RootFolder
#Get the welcome page
$welcomepage = $folder.WelcomePage
$file = $web.GetFile("$welcomepage")
$file.CheckOut()
$wpm = $web.GetLimitedWebPartManager("$welcomepage", [System.Web.UI.WebControls.WebParts.PersonalizationScope]::Shared)
foreach($webpart in $wpm.WebParts){
            if($webpart.MyUniqueProperty){
if(!$webpart. MyUniqueProperty){
$webpart. MyUniqueProperty = $ MyUniquePropertyValue(Value which need to be Set/Update)
                                    $wpm.SaveChanges($webpart)
}#First If
}#Second If
}#Foreach
$file.CheckIn("Updated/Set property of webpart",1)
            $file.Publish("Updated/Set property of webpart")
            $site.Dispose()           
}#foreach

所以,选项D是本题的正解。
选项A.重新升级网站定义。这方法我们在前面已经予以了否定。
选项B.创建Delegate Control作用不到你自行开发的Web Part部件,更别说还需要代码开发了。
选项C.通过代码升级Web Part是需要创建解决方案并部署的,不能直接采取像本选项这样的操作,而且仅仅更改Web Part的属性似乎用不着那么大的动静。
因此本题答案应该选 D

参考 
http://msdn.microsoft.com/zh-cn/library/ms463169(v=office.14).aspx
http://msdn.microsoft.com/zh-cn/library/bb861862(v=office.12).aspx

 

Question  150
 You have an existing SharePoint 2010 solution consisting of custom Web Parts deployed to the global assembly cache (GAC). The signing key used for the Web Parts has recently changed. You need to design an update to the Web Parts without any change to the value settings of their properties. Which approach should you recommend?
A. Deploy the changes within a SharePoint solution.
B. Copy the changes directly to the GAC and perform an IISReset.
C. Programmatically copy the information from the existing Web Parts to their new versions and then remove the old instances.
D. Update the Web Parts through the Web Part gallery and select the Overwrite if file already exists check box.


解析:
   你有一个Sharepoint2010解决方案,此方案包含一些部署在GAC中的Web Part,现在,这些Web Parts的signing key发生了改变,你需要升级这些Web Parts而无需通过改变它们的属性做到这点,你该如何操作呢?
   我们已经知道,WebPart就是组成网页(Web)的部件(Part),它是SharePoint站点WebPartPage的基本构建块。在SharePoint网站的页面上,数据的显示、数据的编辑,都是通过一个一个的WebPart来完成的;实质上,WebPart是ASP.NET自定义控件,都是由一个WebPart说明文件(.dwp)和WebPart程序集(.dll)组成。
   由于本题已经指出: “此方案包含一些部署在GAC中的Web Part,现在,这些Web Parts的程序集签名(signing key)发生了改变”。也就是说,此时的Web Part程序集已经不再是原来的程序集了,你实质上是新建了一个程序集来升级你的Web Part。而题目要求你: “你需要升级这些Web Parts而无需通过改变它们的属性做到这点”, 我们知道,在Web Part的.webpart文件中定义了其相关的属性信息,所以,我们就需要把这些信息拷贝到新的WebPart项目中来。
   做完上述工作并部署了新的Web Part程序集后,你会发现,Sharepoint系统仍旧使用的是旧的Web Part,你并未升级它们。这是因为,这种操作并不是某种意味上的”升级”。由于使用了新的签名的程序集,老的程序集仍然存在,并且Sharepoint系统中已经创建的Web Part仍旧使用并仍旧可以成功的找到老的Web Part程序集。所以即使你部署了新的Web Part程序集,老的Web Part仍旧没有改变。
   因此,你只有删除这些老的Web Part,然后再依据新的Web Part功能来创建新的Web Part实例,但由于拷贝了原来的Web Part的相关信息,所以新版本Web Part实例的相关属性信息还是原来的样子。 所以,只有选项C正确描述了这样的操作。
   选项A. 这句话等于没说,我们本来就是要通过解决方案来部署我们的更改。
   选项B. 完全是混淆描述,你怎么能直接到GAC的程序集中拷贝所作的更改呢?所有的更改应该是在解决方案中完成,然后再编译并部署到GAC中。
   选项D. 我们知道,只有Web Part的描述信息可以上载到Web Part Gallery,而Web Part的功能实现是在程序集,所以,本选项的操作其实并没实现本题的要求。
因此本题答案应该选 C

参考 
http://msdn.microsoft.com/en-us/library/ee231579.aspx
http://msdn.microsoft.com/en-us/library/dd583149(v=office.11).aspx


Question  151
 You are designing a SharePoint 2010 intranet site for your company. Your design needs to meet the following requirements:
.A SharePoint feature (feature A) must make a custom list definition available for the entire site collection.
.Another SharePoint feature (feature B) must provision an instance of that custom list definition in the particular
site where the feature is activated. Which approach should you recommend?
A. Set the scope of feature A to Web and the scope of feature B to Site. Add feature A to the set of Activation Dependencies in feature B.
B. Set the scope of feature A to Web and the scope of feature B to Site. Add feature B to the set of Activation Dependencies in feature A.
C. Set the scope of feature A to Site and the scope of feature B to Web. Add feature A to the set of Activation Dependencies in feature B.
D. Set the scope of feature A to Site and the scope of feature B to Web. Add feature B to the set of Activation Dependencies in feature A.

解析:
 你为公司设计一个Sharepoint2010内部网站,需要满足如下要求:
 要求1.功能A为所有的网站集提供一个列表定义
 要求2.功能B基于要求1中的列表定义在其所被部署和激活的网站上创建列表实例
 你该如何操作呢?
首先,根据要求1,功能A属于网站集级别。
其次,由于功能B是依赖于功能A,用于创建具体的网站实例,所以功能B的级别属于具体的Web,且依赖于功能A。在所有备选项中只有选项C符合这样的逻辑。
因此本题答案应该选 C 
参考 
http://msdn.microsoft.com/zh-cn/library/aa543162(v=office.14).aspx

posted @ 2014-10-12 09:19  wsdj  阅读(696)  评论(0编辑  收藏  举报