My Techie Blog

  Home  |   Contact  |   Syndication    |   Login
  110 Posts | 5 Stories | 406 Comments | 0 Trackbacks

News

Archives

Post Categories

ADO.NET

Ajax

API/WebServices

ASP.NET Resources

BizTalk Server

Blogs I read

Free Books

How to

iOT

JavaScript

JQuery

JSLink - SharePoint

JSON

LINQ

Misc

Mobile BI

MS Business Inteliigence

Reporting Services

Responsive/MVC ASP.NET

SEO

Sharepoint Resources/Tools

SharePoint 2010 Branding

SharePoint 2010 Videos

SharePoint 2013

SharePoint Online

SilverLight

SPServices

SQL Server

Sql Server 2012

SSIS

Web Optimization Tools

Web Performace Tools

Windows 8

Windows Azure

Windows Azure

Windows Phone

WorkFlows

WSS V3

xml

I just surfed on this on the sharepoint forum so i decided to share

It can save a lot of time though

Getting Started Topics


SharePoint Developer Introduction for .NET Developers

http://www.microsoft.com/click/SharePointDeveloper/

 

Microsoft SharePoint Team Blog

http://blogs.msdn.com/sharepoint/

 

Troubleshooting Topics

Problem Area: Debugging and Troubleshooting

Problem

When developing against the SharePoint object model in an application outside of IIS (service, console, Winforms etc..) on a machine that is not part of a SharePoint farm you receive the error “Unhandled Exception: System.TypeInitializationException: The type initializer for 'Microsoft.SharePoint.CoreResource' threw an exception. ---> System.IO.FileNotFoundException: Could not load file or assembly”

Resolution

The SharePoint object model can only be used when the application is run on a server in the SharePoint farm. It cannot be executed remotely. If it is not possible to run the application on a SharePoint farm server you should investigate using the SharePoint web services instead.

The Windows SharePoint Services and Microsoft Office SharePoint Services web services are documented in the following SDK’s.

SharePoint Server 2007 SDK: Software Development Kit

http://www.microsoft.com/downloads/details.aspx?FamilyId=6D94E307-67D9-41AC-B2D6-0074D6286FA9&displaylang=en

Windows SharePoint Services 3.0: Software Development Kit (SDK)

http://www.microsoft.com/downloads/details.aspx?FamilyID=05e0dd12-8394-402b-8936-a07fe8afaffd&DisplayLang=en

Problem

You receive “The "yourWebPartName" Web Part appears to be causing a problem” or a generic error message when developing a web part.

Cause

Exceptions are caught by SharePoint and a friendly error message is displayed instead of a stack trace.

Resolution

To configure SharePoint to display the full exception needed for debugging make the following changes to your SharePoint site’s web.config file (typically located in \Inetpub\wwwroot\wss\VirtualDirectories\yoursite).

·         Find:   <SafeMode CallStack="false" />

·         Replace with: <SafeMode CallStack="true" />

·         Find:   <customErrors mode="On" />

·         Replace with: <customErrors mode="Off" />

·         Find:   <compilation debug="false" />

·         Replace with: <compilation debug="true" />

Problem

You receive “Unknown Error” or another generic error message when developing aspx pages beneath _layouts.

Cause

Application pages beneath _layouts have a separate web.config file that needs updated to enable more detailed error messages.

Resolution

Open \Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS\web.config

Add the following XML block immediately after the <configuration element.

  <SharePoint>

    <SafeMode CallStack="true">

      <PageParserPaths>

      </PageParserPaths>

    </SafeMode>

  </SharePoint>

·         Find:   <compilation debug="false" />

·         Replace with: <compilation debug="true" />

 

Problem

You are developing a SharePoint component on an XP or Vista client and you need to debug to troubleshoot your component.

Resolution

Enable Visual Studio 2005 or 2008 Remote Debugging to enable remotely setting breakpoints and single step debugging through your code.

A high level overview of how to do this:

·         Install the remote debugging components onto the development server (note this doesn’t require a full VS.NET install)

·         Run the Visual Studio 2005 Remote Debugger Configuration Wizard on the development server

·         Visual Studio 2005 Remote Debugger on the development server

·         Install a debug version of your component on to the server along with the symbol files (.pdb). For debugging, deploying to the \bin directory is preferable.

o   Note: If you install your assembly to the global assembly cache (GAC) you will need to copy the .pdb to the directory where the assembly is installed.

§  You can find this out from a command line by typing in the following commands:

·         cd \windows\assembly

·         dir /s YourAssemblyName.dll

·         Copy the .pdb files out of your \debug directory to this directory to enable debugging.

·         Ensure that debug=”true” is enabled in your SharePoint sites web.config

·         Open the project in Visual Studio on your client (ensure this is the exact same version/build of the assembly that is deployed – do not rebuild)

·         Click Debug -> Attach to Process -> change the text in the “Qualifier” text box to be the remote server’s name then click the “Refresh” button.

o   Ensure that “Managed” is checked in the “Attach To” area.

o   Note: If there are connection problems at this point see the following KB articles for additional configuration steps.

§  http://support.microsoft.com/kb/910448 How to implement remote debugging in Visual Studio 2005

§  http://support.microsoft.com/kb/908099 How to turn on remote debugging for Visual Studio 2005 in Windows XP with Service Pack 2

§  http://support.microsoft.com/kb/947252 Error message when you try to use the Remote Debugging Monitor in Visual Studio on a Windows Vista-based computer: "The Windows Firewall is currently blocking remote debugging"

·         You should see a list of processes appear. You will need to select w3wp.exe (there may be multiple instances) and click “Attach”.

·         Once attached to the correct instance you can set a break point in the code that you need to debug and reproduce the problem on the server.

o   For web parts this could be refreshing the page

o   For a feature receiver this could be activating or deactivating the feature

o   For an event receiver this could be manipulating data in a list (such as adding, deleting, check-in/check-out) etc…

·         The full detailed approach of configuring remote debugging: http://msdn.microsoft.com/en-us/library/bt727f1t(VS.80).aspx

 

Problem

You are trying to call a SharePoint web service but you are receiving SoapException errors.

Resolution

Add a catch handler to your web service call and handle the SoapException. Inside of the Detail property will be more detailed information to assist troubleshooting.

catch (System.Web.Services.Protocols.SoapException se)

{

        // se.Detail has more information

}

 

 

Problem Area: Memory Leaks

Problem

Your SharePoint site is exhibiting heavy memory usage and is performing slowly or you are experiencing application pool recycles due to out of memory conditions.

Resolution

Please review Roger Lamb’s blog entry “SharePoint 2007 and WSS 3.0 Dispose Patterns by Example” to ensure you are properly utilizing the Dispose method when using the SharePoint object model.

http://blogs.msdn.com/rogerla/archive/2008/02/12/sharepoint-2007-and-wss-3-0-dispose-patterns-by-example.aspx

 

Problem Area: User Profiles

Problem

When using the SharePoint class UserProfileManager to read user profiles you receive the error “Only an administrator may enumerate through all user profiles”.

Resolution

There is now a hot fix available for this. At the time of this writing the KB article is not published but you can call into Microsoft support and request the fix by number 952294.

 

Problem Area: Security

Problem

When calling a web service from within a Web Part or an application outside of IIS you receive the following error:

Unhandled Exception: System.Net.WebException: The request failed with HTTP status 401: Unauthorized.

Resolution

The web service needs credentials to be set before making calls.

Examples:

·         listService.UseDefaultCredentials = true;  // use currently logged on user

·         listService.Credentials = new System.Net.NetworkCredential("user", "pass", "domain"); // use specified user

 

Problem

When developing against the SharePoint object model in an application outside of IIS (service, console, Winforms etc..) you receive the error “FileNotFoundException” when creating an instance of the SPSite object.

Resolution

The user running the application needs to have the following permissions and group membership set:

·         The user is a server farm administrator. 

·         The user has Read and Write permissions on the content database. 

·         The user is a site collection administrator. 

·         The user has permissions to access the Windows SharePoint Services site or the SharePoint Server 2007 site through which the code iterates. 

 

Problem Area: VSEWSS

Problem

You receive the error “This solution contains two assemblies with the same name, or the SharePoint server already has an assembly with the specified name.” when deploying a solution using the Visual Studio Extensions for SharePoint (VSEWSS) after you have already deployed it to a different site on the same server.

Resolution

Remove the solution’s assembly from the Global Assembly Cache (GAC).

·         Gacutil –uf assemblyName   (note: no .dll extension is specified)

·         Rename or Remove the feature from “Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\FEATURES\FeatureName”  (note: FeatureName may not be the same as assembly name – look in your manifest.xml to find the correct name)

 

Problem

When trying to deploy a VSEWSS solution using the Visual Studio “Deploy” command you receive the error “Value does not fall within the expected range.”

Resolution

Remove all projects except the VSEWSS project from the Visual Studio solution then attempt your deployment again.

 

Problem Area: Event Receivers

Problem

You receive the error “Attempted to read or write protected memory.” when trying to cancel a checkout using the ItemCheckingOut Event Receiver.

Resolution

This is a known issue. To workaround you should set the Status property to SPEventReceiverStatus.CancelNoError instead of SPEventReceiverStatus.CancelWithError or setting properties.Cancel = true;

See http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spitemeventreceiver.itemcheckingout.aspx for more details.

 

posted on Monday, June 16, 2008 7:57 PM

Feedback

# re: Some Sharepoint problems and resolutions 7/7/2008 7:38 PM omid gh
Hi . i installed and Sharepoint in full installation and Sql Server 2005 . but now i can not start Serch services !! what should i do ? please help me

# re: Some Sharepoint problems and resolutions 7/7/2008 7:45 PM Patrick
When you say you can't start search service. Have you tried it from the Sharepoint Admin Central. If yes whats the error??
Make sure that all your acct are all right and check if they have access to the database etc..
Also have you selected the server to use for the search.
Check for this options in the Sharepoint Admin Central.
If you have more issues let me know.

# re: Some Sharepoint problems and resolutions 10/20/2008 10:22 PM Aravindh
Hi,

I am new to sharepoint development, i tried to use inbuilt sharepoint web service to an item in Document libraries in WSS 3.0. I used UpdateListItems service to update an item.
I am using VS 2005. I have created an ASP.Net application and referenced the Web service in the local machine.
UpdateListService.Lists listService = new UpdateListService.Lists();
listService.PreAuthenticate = true;
listService.UseDefaultCredentials = true;
listService.Credentials = new System.Net.NetworkCredential("xxxxx","xxxxx","xxxxxx");
System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
System.Xml.XmlElement batchElement = doc.CreateElement("Batch");
batchElement.SetAttribute("OnError", "Continue");
batchElement.SetAttribute("ListVersion", "1");
batchElement.InnerXml = "<Method ID='1' Cmd='Update'>" +"<Field Name='ID'>6</Field>" +"<Field Name='Sampl'>Modified sixth item</Field></Method>";

listService.UpdateListItems(WssDoc.SelectedItem.ToString(), batchElement);
web.AllowUnsafeUpdates = false;



# re: Some Sharepoint problems and resolutions 10/20/2008 10:24 PM Aravindh
Hi,

I am new to sharepoint development, i tried to use inbuilt sharepoint web service to an item in Document libraries in WSS 3.0. I used UpdateListItems service to update an item.
I am using VS 2005. I have created an ASP.Net application and referenced the Web service in the local machine.
UpdateListService.Lists listService = new UpdateListService.Lists();
listService.PreAuthenticate = true;
listService.UseDefaultCredentials = true;
listService.Credentials = new System.Net.NetworkCredential("xxxxx","xxxxx","xxxxxx");
System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
System.Xml.XmlElement batchElement = doc.CreateElement("Batch");
batchElement.SetAttribute("OnError", "Continue");
batchElement.SetAttribute("ListVersion", "1");
batchElement.InnerXml = "<Method ID='1' Cmd='Update'>" +"<Field Name='ID'>6</Field>" +"<Field Name='Sampl'>Modified sixth item</Field></Method>";

listService.UpdateListItems(WssDoc.SelectedItem.ToString(), batchElement);
web.AllowUnsafeUpdates = false;

I am facing The request failed with HTTP status 401: Unauthorized


# re: Some Sharepoint problems and resolutions 1/15/2009 6:12 AM Ramprasad
Resolution for Problem Area: User Profiles

http://dotnetdreamer.wordpress.com/2009/01/15/enumerating-sharepoint-user-profiles-access-denied-exception/

# re: Some Sharepoint problems and resolutions 2/13/2009 4:33 AM Joe Griffith
In daily use of sharepoint an error happens where the user clicks on a file to open, instead of opening an error message appears.

"Internet Explorer has encountered a problem and needs to close. We are sorry for the inconvenience."

Then the browser closes. To view the file it must be saved to a location before opening. Other Sharepoint features work fine.

# re: Some Sharepoint problems and resolutions 9/2/2009 5:49 AM Jude Mahoney
Hi,
I've been administrating a SP based site for my work. It's only a secondary role for me, but I've had one user say every time she clicks on a link in the left hand navigation menu, it automatically shuts down SP and kicks her out. I and some of my colleagues have followed the same link, with no problems at all. Can you help me please, any suggestions?

Thanks,

Jude

# re: Some Sharepoint problems and resolutions 10/23/2009 10:42 PM Vijay
Hi, my sharepoint server crashed so i have installed sharepoint on other server and given samehost name and configured same IP. Now my default site is working but when I click on insite links it prompt me authenticate window.I passed right information but it can not go ahead.Please help

# re: Some Sharepoint problems and resolutions 11/6/2009 9:36 AM LP
I closed a webpart in SP. Now when I open SP, the webpart is gone, but when I go to site actions, edit page, the webpart is there. I exit edit mode and the webpart stays until I close SP and begin again. !have to repeat this same process everytime. How do I get the missing webpart to display permanently?

# please reply 10/17/2011 6:45 PM neeraj

1. Create SharePoint WebPart Project.
2. Add some functionality on to the Project.
3. Try to access some text file and write something to that text file. This can be logging file. Best way is to have nlog used to make this problem more complex.
4. Deploy WebPart.
5. Login using different user who has basic rights on SP Resources.
6. Browsing this page makes page crash.

please provide solution immediately.....

Post A Comment
Title:
Name:
Email:
Comment:
Verification: