快捷搜索:  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

免责声明:以上内容源自网络,版权归原作者所有,如有侵犯您的原创版权请告知,我们将尽快删除相关内容。

您可能还会对下面的文章感兴趣: