While there isn’t any Solution Package items to add httpHandlers and other web.config edits, you can do these through Feature Receivers. Tony pointed this out in his post @ sharepointsolutions.blogspot.com, so I decided to update the code for the Atlas RC and add it to a Feature Reciever in the SharePoint.Ajax Codeplex Project. Otherwise, I’ve got this great installer technology that scales well across farms and enables no-touch dpeloyment EXCEPT for that httpHandler. That’s really a bummer– so I’m glad to have found a solution! We now have a complete no-touch deployment solution in place for the SharePoint Ajax components, which isn’t bad for such a "young" project this early in development!
The Feature Reciever is defined in the Feature manifest with the following attributes:
ReceiverAssembly="SharePoint.Ajax, Version=1.0.0.0, Culture=neutral, PublicKeyToken=5ed42c8fcfe5cf7c"
ReceiverClass="SharePoint.Ajax.Config.FeatureReceiver"
This seems to work well in the Solution Package when the Feature is set to the SPWeb’s scope, when handling the FeatureActivated method. It is now standard part of my Ajax project’s Solution Package projects, including SharePoint.Ajax on Codeplex. If you’d like to see the full source code, it’s in change set 15970 or newer.
public const string ScriptResource =
@"<add verb=""GET,HEAD"" path=""ScriptResource.axd""
type=""System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35""
validate=""false"" />"; public override void FeatureActivated(SPFeatureReceiverProperties properties) { SPWebApplication app = null; SPSiteCollection site = properties.Feature.Parent as SPSiteCollection; if (site == null) { SPWeb web = properties.Feature.Parent as SPWeb; if (web != null) app = web.Site.WebApplication; } else app = site.WebApplication; bool removeModification = false; if (app != null) AddAjaxHandlerToWebConfig(app, removeModification); else throw new ApplicationException("Could not locate a web application"); } public static void AddAjaxHandlerToWebConfig(SPWebApplication app, bool removeModification) { SPWebConfigModification modification = new SPWebConfigModification( "add[@path='ScriptResource.axd']", "configuration/system.web/httpHandlers"); modification.Owner = "SharePoint.Ajax"; modification.Sequence = 0; modification.Type = SPWebConfigModification.SPWebConfigModificationType.EnsureChildNode; modification.Value = ScriptResource; if (removeModification) app.WebConfigModifications.Remove(modification); else app.WebConfigModifications.Add(modification); SPFarm.Local.Services.GetValue().ApplyWebConfigModifications(); }
Again, thanks to Tony for the original post.
*Note: typo in AddAjaxHAndlerToWebConfig fixed on 1/10. Original post on 1/9.
hi Daniel
I am not quite sure how Sharepoint deals with features when you add new servers into the farm (after the initial feature to update the web.config is activated). As you add the new server to the farm, does the featureActivated/Installed fire again on that new server ? i guess it would be nice if it did, but then again if you put some code in your feature that updates sharepoint permissions for example, you would want this run against the content db again. Any ideas ? Is there an event when the solution package is deployed to the box as that would be the ideal ?
Cheers
Mark
When you add a new server to the farm, those events shouldn\’t fire again. The data is all in the content db– so WSS just looks at configurations from teh config db (including SPWebConfigModifications) and extends the new server with those IIS sites and web configs. Also, solutions deployed to the original server should get pushed to the new server. It\’s because of this model that no-touch deployments using WSS standard technology is the preferred way to deploy applications.
hi Daniel,I use this feature to install handlers, but I had a question. I have a handler that references an assembly in the GAC. When I install using your code, it puts the handlers in the web.config, but can\’t find the assemblies. When I move those handlers to the web.config in the http://localhost/_wpresources folder, it works just dandy.Is there a way to pop that handler in there instead of in the web.config right in my virtual directory? Or am I missing something?Thanks.
ECサイト構築 ウィークリーマンション
治験 結婚指輪
太陽光発電 結婚式 演出 吉原 ソープ
債務整理
害虫駆除 法律事務所 求人 看護師
キャッシング
転職 バイアグラ ショッピング枠 現金化 釣り 釣具
別れさせ屋 価格 賃貸
不動産担保ローン 介護 看護師 会社設立 横浜中華街 ウェディングドレス ウェディング
カラコン
メル友 ウィークリーマンション
自動車ガラス 不動産 ダイビング
葬儀 東京ショッピング枠 現金化 データ復旧 テレマーケティング RAID復旧 データ復元 データ復旧
ECサイト構築介護 葬儀 東京 治験
横浜中華街 会社設立
データ復旧 結婚式 演出
吉原 ソープ
デリヘル
精力剤 勃起薬 熟女横浜デリヘル 品川デリヘル すすきの 風俗