自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

幾條在SharePoint中使用SilverLight注意事項

開發(fā) 后端
練習(xí)了一下在SharePoint站點中使用SilverLight,方法當(dāng)然是創(chuàng)建一個WebPart,然后在其中承載System.Web.UI.SilverlightControls下的Silverlight控件。不過這里面也有不少SilverLight注意事項。

在SharePoint中使用SilverLight,說起來雖然簡單,但是還是折騰了我一些時間:

在SharePoint中使用SilverLight注意事項

首先,需要將Silverlight程序中產(chǎn)生的xap文件拷貝到您的sp站點可以訪問到的地方。然后創(chuàng)建一個webpart,在其中創(chuàng)建Silverlight的實例對象,然后為其指定Source="****.xap"特別注意的是,SilverLight的運行需要ScriptManager的支持。

在我練習(xí)的過程中,主要遇到的問題是web.config文件對sl的支持,及相關(guān)MIME頭的添加。

--web.cofig添加對sl的支持:

1、在原文件的configSections中添加一段sectionGroup,如下:

  1. <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"> 
  2.       <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"> 
  3.         <section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" /> 
  4.         <sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"> 
  5.           <section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere" /> 
  6.           <section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" /> 
  7.           <section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" /> 
  8.           <section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" /> 
  9.         </sectionGroup> 
  10.       </sectionGroup> 
  11.     </sectionGroup> 

2、在system.web的httpHanders和httpModules節(jié)結(jié)束處分別加入如下:

  1. <remove verb="*" path="*.asmx" /> 
  2.       <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> 
  3.       <add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> 
  4.       <add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false" /> 
  5.  <add name="PublishingHttpModule" type="Microsoft.SharePoint.Publishing.PublishingHttpModule, Microsoft.SharePoint.Publishing, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" /> 

3、在compliation的assemblies節(jié)中加入如下:

  1. <!--如果您的是3.5的NET Framework的話,可能還需要加上如下:  
  2.         <add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" /> 
  3.         <add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> 
  4.         <add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" /> 
  5.         <add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" /> 
  6.         --> 
  7.         <add assembly="System.Web.Silverlight, Version=2.0.5.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> 

4、如果是在IIS7中的話,需要加上如下:

  1. <system.webServer> 
  2.     <validation validateIntegratedModeConfiguration="false" /> 
  3.     <modules> 
  4.       <remove name="ScriptModule" /> 
  5.       <add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> 
  6.     </modules> 
  7.     <handlers> 
  8.       <remove name="WebServiceHandlerFactory-Integrated" /> 
  9.       <remove name="ScriptHandlerFactory" /> 
  10.       <remove name="ScriptHandlerFactoryAppServices" /> 
  11.       <remove name="ScriptResource" /> 
  12.       <add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> 
  13.       <add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> 
  14.       <add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> 
  15.     </handlers> 
  16.     <security> 
  17.       <authorization> 
  18.         <add accessType="Allow" users="" /> 
  19.         <add accessType="Allow" users="?" /> 
  20.       </authorization> 
  21.     </security> 
  22.   </system.webServer> 

--經(jīng)過上述處理,應(yīng)該就可以完成SP中支持SL了。

特別提醒在SharePoint中使用SilverLight注意事項:如果您是網(wǎng)上找的web.config模板的話,特別注意其中的machineKey這個節(jié)點,把它改成您原來config值,不然的話,連您的sp站點都掛了。
---

接下來的事,就加入承載Silverlight的webpart享受了~~~~

但是:您還有可能碰到這個情況:在SL區(qū)域點右鍵已經(jīng)可以看到silverlight的runtime信息了,可是這個區(qū)域卻是一片空白??

原因就在于Silverlight中需要使用xap、XAML文件類型

所以必須在IIS中注冊xaml和xap的MIME文件類型。打開IIS->站點屬性->HTTP頭->MIME類型->新建:

擴展名: .xap

MIME類型:xapapplication/x-silverlight

擴展名: .xaml

MIME類型:application/xaml+xml

---
在SharePoint中使用SilverLight注意事項:最后在啰嗦一下web.config

其中,在vs08中創(chuàng)建sl-application的時候,就會提示您是否創(chuàng)建host站點。選擇創(chuàng)建后,看看它的web.config有哪些是運行sl需要的,把它copy到sharepoint的web.config對應(yīng)位置即可。

在SilverLight程序中,最好不要使用到.NET 3.5下相關(guān)的技術(shù),比如linq等,因為.net20(SharePoint07運行在.net20下)不支持這些東東。

復(fù)制相關(guān)的web.config節(jié)的時候,去除.net3.5下的東東即可。還有一個不需要復(fù)制的,就是pages節(jié)點下的<controls>關(guān)于asp:SilverLight等的注冊。

【編輯推薦】

  1. 微軟Silverlight 3挑戰(zhàn)Adobe AIR
  2. RIA大戰(zhàn)在即 微軟Silverlight勝算幾何
  3. 圖解Silverlight 3的7個新功能
  4. Flash與Silverlight多領(lǐng)域?qū)崪y對比
  5. 微軟宣稱Silverlight裝機量超過三億
責(zé)任編輯:彭凡 來源: cnblogs
相關(guān)推薦

2012-12-27 13:04:17

Android開發(fā)SQLite數(shù)據(jù)庫

2009-07-01 02:29:24

臨時表T-SQL

2021-08-26 14:55:55

開發(fā)React代碼

2010-08-20 13:36:01

2010-11-26 16:27:01

MySQL使用變量

2011-07-19 10:16:58

噴墨打印機注意事項

2010-01-18 14:25:19

使用C++Builde

2011-07-28 17:29:22

HBaseShell

2011-04-14 11:28:07

光纖

2012-03-12 16:46:22

NoSQL數(shù)據(jù)庫

2009-12-15 17:47:17

VSIP

2012-03-02 10:51:06

JavaJDBC

2010-09-16 09:52:49

CSS display

2010-01-21 11:30:10

2009-12-22 09:48:58

WCF枚舉類型

2011-05-26 11:22:04

SEO

2011-07-26 18:43:34

HBase Shell

2013-09-25 10:15:51

閃存存儲優(yōu)勢注意事項

2010-07-20 13:02:03

SQL Server索

2009-12-23 17:05:35

ADO.NET調(diào)用
點贊
收藏

51CTO技術(shù)棧公眾號