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.html

解析:
 你公司有一個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).aspxweb

 

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).aspxapp


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來作到這點。下面是樣例代碼:frontend

$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 ide

參考 
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

相關文章
相關標籤/搜索