?
快捷搜索:  as  test  1111  test aNd 8=8  test++aNd+8=8  as++aNd+8=8  as aNd 8=8

和記怡情娛:Sharepoint 70573考試習題和解析(Q8Q10)

?

Qeustion 8

You have a SharePoint site collection. The root Web of the site collection has the URL http://intranet.

You plan to create a user solution that will contain a Web Part. The Web Part will display the title of the root Web.

You write the following code segment for the Web Part. (Line numbers 和記怡情娛are included for reference only.)

01 SPSite currentSite = new SPSite("http://intranet");

02

03 Label currentTitle = new Label();

04 currentTitle.Text = currentSite.RootWeb.Title;

You add the Web Part to a page in the root Web and receive the following error message: "Web Part Error: Unhandled exception was thrown by the sandboxed code wrapper's Execute method in the partial trust app domain: An unexpected error has occurred."

You need to prevent the error from occurring.

What should you do?

A. Add the following line of code at line 02:

currentSite.OpenWeb();

B. Add the following line of code at line 02:

currentSite.OpenWeb("http://intranet");

C. Change line 01 to the following code segment:

SPSite currentSite = SPContext.Current.Site;

D. Change line 04 to the following code segment:

currentTitle.Text = currentSite.OpenWeb().Title;

解析:

由報錯信息” Unhandled exception was thrown by the sandboxed code wrapper's Execute method in the partial trust app domain: An unexpected error has occurred”可以判斷這個差錯是因為Sandbox Solution在受限操作方面孕育發生的問題。

首先來看 A. B選項,它們都應用了OenWeb()措施,此措施是返回一個SPWeb工具,以是選項A, B在語法上都是差錯的(左側應該定義一個SPWeb變量來承接右邊的措施返回值)。

選項C. 有些人覺得SPSite工具是不容許在Sandbox solution中應用的,這種熟識不全對,實事上,我們可以在Sandbox Solution中應用SPSite工具,但條件是此SPSite工具”必須”位于”當前”的Site Collection中(也即:此Site Collection是位于當前的Context下的),以是,我們只能應用下面的語句來在Sandbox Solution中獲取SPSite工具:

SPSite currentSite = SPContext.Current.Site;

假如要應用類似于本題目經由過程URL要領來獲取SPSite,則并不能維持你供給的URL與Webpart在同一個Site Collection中,以是就很可能跳出上面的差錯。

選項 D.很顯著,假如差錯是因為在Sandbox Solution中獲取SPSite工具的措施引起的,那么,選項D并不能辦理這個差錯。

以是本題目精確選項應該是C

參考:

http://social.msdn.microsoft.com/forums/en-US/sharepointgeneralprevious/thread/e84a457e-068c-465d-95f8-db56ac130cda

http://msdn.microsoft.com/en-us/library/ms473155.aspx

Question 9

You need to disable the CriticalExceptionCount measure for all user solutio和記怡情娛ns.

You write the following code segment. (Line numbers are included f和記怡情娛or reference only.)

01 SPUserCodeService userCode = SPUserCodeService.Local;

02 SPResourceMeasureCollection measures = userCode.ResourceMeasures;

03 SPResourceMeasure measure = measures["CriticalExceptionCount"];

04

05 measure.Update();

Which code segment should you add at line 04?

A. measure.AbsoluteLimit = 0;

B. measure.AbsoluteLimit = 1;

C. measure.ResourcesPerPoint = 0;

D. measure.ResourcesPerPoint = 1;

解析:

本題目主要涉及到Sandbox Solution的資本配額治理,SharePoint 2010嚴格監控沙盒辦理規劃中的代碼的運行狀況。每個網站集均受可設置設置設備擺設擺設的日常資本點 的最大年夜數目的限定。這些點基于某種專有算法進行累計,該算法會斟酌網站集中安裝的沙盒辦理規劃對 14 類資本的應用。當一個網站集越過其容許的最大年夜點數(默認環境下,該數設置為 300)時,該網站集中的所有沙盒辦理規劃都將終止 (請留意:是此網站集中”所有”的沙盒辦理規劃),且在殘剩光陰內再也無法運行。

SharePoint 包孕14個方面的指標(Metric或者ResourceMeasure)來設置響應的應用配額

1. AbnormalProcessTerminationCount

2. CPUExecutionTime

3. CriticalExceptionCount

4. InvocationCount

5. PercentProcessorTime

6. ProcessCPUCycles

7. ProcessHandleCount

8. ProcessIOBytes

9. ProcessThreadCount

10. ProcessVirtualBy和記怡情娛tes

11. SharePointDatabaseQueryCount

12. SharePointDatabaseQueryTime

13. UnhandledExceptionCount

14. UnresponsiveprocessCount

本題提到的便是第3個指標:CriticalExceptionCount

上面的每個指標( ResourceMeasure)都包孕有 ResourcesPerPoint 屬性。 例如: AbnormalProcessTerminationCount 的 Resou和記怡情娛rcesPerPoint 值為 1。 每次發生了AbnormalProcessTermination差錯(非常終止沙盒辦理規劃差錯),則添加 1個 磅值。 假如想增添終止了沙盒辦理規劃罰點可以將 ResourcesPerPoint 設置為 2。 假如您不關心此統計數據,您可以應用 0。

上面的每一個指標還定義有一個AbsoluteLimit屬性,此屬性用于限定Sandbox Solution可耗損的此指標限定量, 比如,“UnhandledExceptionCount (ResourcesPerPoint: 50AbsoluteLimit :3)” 表示:每50個未捕獲非常將耗損1個“點數”,而天天假如某個辦理規劃包因為未捕獲非常的緣故原由耗損了3個“點數”(也便是它發生了150次非常未捕獲的環境),那么這個沙盒辦理規劃包將被直接中止運行(請注音:是此沙盒辦理規劃),縱然網站集當前還有殘剩“點數”。假如不關心此統計數據,則可設置它的ResourcesPerPoint屬性為0。

以是,AbsoluteLimit的值只會影響單個辦理規劃,這點不像天天最大年夜應用率。這個兩個級其余配額,逐日的配額和絕對的限定,一路事情合營保護場的康健。

有了上面的描述,再回到本題就很明確了,A.B首先掃除,由于它們都只針對單個Sandbox Solution的限定,本題必要針對for all user solutions,以是只能是設置屬性ResourcesPerPoint為0

以是本題目精確選項應該是C

Question 10

You created a custom ASPX page that updates a list. The page is deployed to the _layouts folder.

The page contains the following code segment. (Line numbers are included for reference only.)

01

02 http://msdn.microsoft.com/zh-cn/library/ms472879.aspx

免責聲明:以上內容源自網絡,版權歸原作者所有,如有侵犯您的原創版權請告知,我們將盡快刪除相關內容。

您可能還會對下面的文章感興趣:

快三平台开户