330 likes | 459 Views
MOSS Ongelmienselvitys - Mitä nyt kun se ei toimi? Aku Heikkerö, Vesa Juvonen Microsoft Consulting Services (MCS). Agenda. Eri lokien hyödyntäminen ja konfigurointi Debuggaus MOSS:ssa Best practices – kuinka vältän turhia virheitä ja hyödynnän alustaa tehokkaasti. Who are we?. Aku Heikkerö
E N D
MOSS Ongelmienselvitys - Mitä nyt kun se ei toimi? Aku Heikkerö, Vesa Juvonen Microsoft Consulting Services (MCS)
Agenda • Eri lokien hyödyntäminen ja konfigurointi • Debuggaus MOSS:ssa • Best practices – kuinka vältän turhia virheitä ja hyödynnän alustaa tehokkaasti
Who are we? • Aku Heikkerö • Senior Consultant, Team leader, BPIO Service Line, Enterprise Services, Microsoft Finland • Member of a worldwide SharePoint Ranger team • In Microsoft since 2003. Companies before Microsoft – ICL, Fujitsu • Email: aku.heikkero@microsoft.com • Vesa Juvonen • Software Development Consultant, BPIO Service Line, Enterprise Services, Microsoft Finland • In Microsoft since 2006, started IT studies 1996 (graduation took a while). Companies before Microsoft – ICL, Fujitsu, BasWare working as Software Architect, Lead Software Development Engineer etc. • Email: vesa.juvonen@microsoft.com • Blog: http://blogs.msdn.com/vesku
Differentlogsavailable • Event Log • System log to track critical errors • Monitoring tools usually track this log for possible indications of problems • Unified Logging Service (ULS) • More comprehensive log to track what happens in the SharePoint • Logging level can be configured based on environment
Eventlog • All critical errors are raised to event log
ULS Log – Howdoesitwork? • Microsoft.Office.Server.Diagnostics.ULS class called from the code • Unfortunately not public class • Depending on the diagnostic logging settings from the Central administration, messages are logged to disk • By default - c:\program files\common files\Microsoft Shared\Web Server Extensions\12\Logs
Controllogging • Can be done from the Central Administration
Analyzing ULS logs • There are no out-of-the-box tools for viewing the logs • Multiple community tools however available • ULS Log Viewer - http://www.codeplex.com/features/
Using ULS logfromowncode • Code example available from the MSDN • http://msdn2.microsoft.com/en-us/library/aa979522.aspx • Integrate the code to your own solution and use it from code
Debugging • Code can be debugged using the Attach Process… approach • WSS3.0 Extensions does the trick for you • Learn how to do this also manually • There’s no way to debug the xml files or site provisioning • ULS is your best friend… maybe goofy friend, but good friend…
Utilize feature framework • Do not edit Out-Of-the-Box features • Take a copy and build your own • Everything deployed to MOSS should be encapsulated to features; if possible • What can be done automatically it should • All the features deployed within the projects should be marked invisible
UseSolutionpackages • Always use solution packages • Xcopy is not the production proof way to deploy • Solution package deployment requires the applications pools to be recycled • Solution deployment package is nothing more than a cabinet package
Quality, Quality, Quality • Developing and functional testing in Development environment • Deployment for Quality Assurance environment follows Acceptance Testing (done in QA) • Production Deployment after the delivery is approved ready for production
Namingconventions • Use project identifier as the naming convention for the: • Feature folders • Site definititions • WebParts and controls • SiteColumns and Content types • Search scopes • Audiences • Solution packages • And the list goes on....
Test as early as possible • Encapsulate v0.1 as fast as possible • Test every feature as independent functinality • Include test cases for the project documentation
What NOT to dowhendeveloping on WSS • Do NOT modify any SQL database tables or stored procedures • Do NOT directly query SQL database tables or stored procedures • Do NOT modify any file WSS installs • Few exceptions, like the docicons.xml • Do NOT modify xml metadata files after the provision has happen • Do NOT assume you’re running solely with Windows Authentication • Do NOT assume that you’re running on a single machine • Do NOT assume everyone is an admin
DisposingSharePointObjects public void GetSPSiteInfo(String strSite) { using(SPSite oSPsite = new SPSite(strSite)) { foreach(SPWeb oSPWeb in oSPSite.Webs) ProcessWeb(oSPWeb); } } public void ProcessWeb(SPWeb oSPWeb) { foreach(SPWeb oSubWeb in oSPWeb.Webs) ProcessWeb(oSubWeb); }
DisposingSharePointObjects public void GetSPSiteInfo(String strSite) { using(SPSite oSPsite = new SPSite(strSite)) { foreach(SPWeb oSPWeb in oSPSite.Webs) { ProcessWeb(oSPWeb); oSPWeb.Dispose(); } } } public void ProcessWeb(SPWeb oSPWeb) { foreach(SPWeb oSubWeb in oSPWeb.Webs) { ProcessWeb(oSubWeb); oSubWeb.Dispose(); } }
Caching data & Objects public Hashtable GetCachedData() { Hashtable oCachedData = (Hashtable)Cache[“CacheName”]; if(oCachedData == null) { oCachedData = QueryToGetCachedData(); Cache.Add(“CacheName”, oCacheddata, null, DateTime.Now.AddHours(1), TimeSpan.Zero, CacheItemPriority.High, OnRemoveCacheItem); } return oCachedData; }
Caching data & Objects public Hashtable GetCachedData() { lock(object) { Hashtable oCachedData = (Hashtable)Cache[“CacheName”]; if(oCachedData == null) { oCachedData = QueryToGetCachedData(); Cache.Add(“CacheName”, oCacheddata, null, DateTime.Now.AddHours(1), TimeSpan.Zero, CacheItemPriority.High, OnRemoveCacheItem); } } return oCachedData; }
Tips & Tricks • Do not deploy files in to layouts folder • New folder located under the layouts • No updating of system aspx pages • No direct access to the DB • ID guidelines • Document the ID’s per implementation that are used • Each project should have their Sequence of their own • Consider to go with the 64-bit • Use .Dispose method
Tips & Tricks continue… • Reduce Unnecessary round-trips • Test your WebParts • USE Cache as much as possible • Querying Large Lists • If possible use RowLimit in the SPQuery • Updating Large Lists • Instead of OM use WebServices
Summary • Use event log and ULS log to solve the environmental issues • ULS log has huge amount of information • Utilize ULS log also in your own projects using custom code • Follow the best practices to avoid common pitfalls
Moreinformation • SharePoint community • http://sharepoint.microsoft.com/sharepoint/ • SharePoint product team blog • http://blogs.msdn.com/sharepoint/ • Visual Studio structure used in demos and more guidelines (in future) • http://blogs.msdn.com/vesku