Showing posts with label An unexpected error has occurred. Show all posts
Showing posts with label An unexpected error has occurred. Show all posts

29 December, 2013

Quick Fixes 1 :Avoiding the Default Custom Error Page in Sharepoint 2010

Hi Guys,

This is my first post on Amol's SharePoint Knowledge Base Blog . I will be starting my posts off with a Quick Fixes Series . The purpose of this series will be to provide immediate solutions to several niggles and quirks in SharePoint that we face on an everyday basis . I will not be diving in depth into the mechanics . Its intended to be a quick solution to your issues.

Lets get started !!

We all of us in development have faced the nagging issue at some point in time of the Default Custom Error Page, this occurs when we have deployed some new code related to web parts or event receivers , or in general for several issues , including deletion of content types etc. 



Before we run into the SharePoint ULS Logs or the event viewer or worse yet start debugging the code let's take a moment and let SharePoint show us the actual error.

Step 1:

The first step we need to take is to the change the web.config in the virtual directory of the web application which should ideally be present under a path similar to this : inetpub\wwwroot\wss\Virtual directories folder\[Central Admin PortNo]\web.config

Inside this web.config we should the following entry <customErrors> mode . This attribute will be having a value "On" . We need to change it to "Off" . Make sure you type it in the same way , the words are case-sensitive.

Step 2:

Next we need to find an attribute  <SafeMode> CallStack in the same web.config as above . This will be having a value of "false". We need to go ahead and change it to "true".

Step 3(Optional) :

Next we need to find an attribute Debug . It should be having the value "false" by default . Go ahead and change this to "true".

So the 3 changes are :
  1. CustomErrors=”Off” instead of the default CustomErrors=”On” 
  2. CallStack=”true” instead of the default CallStack=”false”
  3. Debug=”true” instead of the default Debug=”false”
Once these 3 steps are done we should ideally see a more usable page such as the one shown below :


As you can see this is a much better page . We can go ahead and google the error from here and try and find a relevant fix.

Note: 

It is very possible that even after above 3 steps we are still not able to see the error details .
In this case below are a few more troubleshooting steps that you can use to trace or view the error.

Additional Step 1:

There is another web.config present in the SharePoint hive under the _layouts folder . The layouts folder can be found under the path: C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14

Modify this web.config similar to Step 1 to have the customErrors attribute set as "Off"



Additional Step 2:
If the above does not work then we have another web.config present at the path : C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\ADMIN\
Go ahead and change the customErrors attribute to "Off" in this one as well

These 2 steps should definitely show you the detailed error page in your application if the first 3 haven't already worked.

In addition you can try and enable the default ASP.NET trace to view the errors as well.
This is done by going to web.config again in the virtual directory of your web application i.e the one at :inetpub\wwwroot\wss\Virtual directories folder\[Central Admin PortNo]\web.config

Here find the <system.web> element of the web.config file .

Under this element add the following line : <trace enabled=”true” pageOutput=”true”/>

This will give you some errors traced by ASP.NET trace as well . However this will be useful only when combined with all the above steps.

IMPORTANT NOTE : Please do not forget to perform an IISRESET after all the changes as sometimes the changes in web.config do not reflect by themselves.

Perform an IISRESET and refresh your error page and i sincerely hope you can view a more explicable page than the one you started with . 

Good Luck and watch out for more Quick Fixes from my end. 

Don't forget to comment and ask your queries in the comment section . I'll get back with my comments ASAP.



16 July, 2013

Unexpected error while creating a Business Intelligence Center site - SharePoint 2010

Hello Guys,

Today I am going to share one more interesting issue and troubleshooting steps so that it would be helpful to all of you.

Present environment entities:
-SharePoint server 2010
-SQL Server 2008 R2
-Windows 7 Operating system
-Internet Explorer 7



Problem description: We are trying to use the performance point in SharePoint so one of the basic need is to create a site with BI template i.e. business intelligence

-We opened our site collection
-site actions
-site settings
-site administration
-sites and workspaces
-provided site name, entered the appropriate URL, selected the required template i.e. business intelligence template and clicked OK
-as soon as we clicked OK then we got the following error message

Error Message:
An Unexpected error has occurred
Correlation ID
Date and time

Troubleshooting Done:
-Tried creating different site using different template under the same site collection- it works
-so one thing is sure that problem is with creating a BI template site.
-checked numerous site collection features
-activated performance point services at the site collection level
-checked the SharePoint logs and found the following:

Publishing Feature activation failed. Exception: System.InvalidOperationException: The SharePoint Server Publishing Infrastructure feature must be activated at the site collection level before the Publishing feature can be activated.    

From the above, it’s very clear that what needs to be done to make it working.

Resolution:
Activated Publishing infrastructure at the site collection level

-site actions
-site settings
-site collection administration
-site collection features
-activated Publishing infrastructure feature


Please let me know in case of any queries/questions so that we can discuss and proceed towards the resolution, Thank you.

21 February, 2013

Code Blocks are not allowed in this file error in sharepoint 2010



Hello Everybody,
Today I worked on one critical issue which belongs to our development environment. We have migrated one web application from production environment to development for testing purpose. Migration has been successful but we were facing an exception while browsing the web application.

Error Message:
An error occurred during the processing.
Code blocks are not allowed
Troubleshoot issues with Microsoft SharePoint Foundation.

Server Configuration:
·         2 SharePoint Servers
·         SQL server 2008 R 2
·         Windows Server 2008 R2
·         SharePoint Version: SP2010

Troubleshooting done:
1.    Tried accessing the system pages i.e. settings.aspx, viewlsts.aspx etc. every system was opening fine without any issues. So the issue is with the home page only…
2.    Tried accessing the web part maintenance page, it opened without any issues. We closed the webparts which are present on the home page-just to make sure that there is no problem with the existing webparts. Checked the home page again but same issue.
3.    Tried changing the master page as were able to open the system pages (by appending _layouts/changesitemasterpage.aspx). We changed to different one as we are using custom master page. Checked the results again but same problem.
4.    Opened the site in SharePoint Designer 2010 and checked the status of master page as well as the home page. It was fine and without customization too.

Note: if you see any of these pages in customizable state then I would suggest you to take the backup and try ‘reset to site definition” option.

Obviously, next question will arise- what exactly it will do? Yes, it will reset your page to default state. It means you will lose your customizations. But issue will be resolved and you can customize the page again as per your requirements.

5.    Checked the windows application as well as SP logs (Location: \14\Logs). I would suggest you to analyze these logs before continuing your troubleshooting.

What is my observation\Understanding?
·         Code blocks are only processed for custom pages deployed in the root virtual directory of a site if the code it considered safe.
·         This code is considered safe only if the page is served directly from the file system. As soon as it becomes unghosted for any reason, the code is no longer considered safe and the error shown in the symptom occurs.

Resolution:
As our production web application was working without any issues so I compared the web.config of both the applications. Analyze the code line by line with the production web.config and that’s it. I found the one which was missing in the web.config that belongs to my development web application.

Note: I would suggest you to take a proper backup before making any changes in the web.config file.

What I did? What kind of entries I added in the web.config file?

Here we go:-
In you web.config, you need to search the tag name as “<PageParserPaths>”
Once you find that then make the following  entry:
<PageParserPaths>
    <PageParserPath VirtualPath="/apps/*" CompilationMode="Always"
              AllowServerSideScript="true" IncludeSubFolders="true" />
</PageParserPaths>
After adding this entry then IISRESET is mandatory.

Tried accessing the site and the issue has been resolved.

Happy SharePoint once again…

If you have any queries/questions regarding the above mentioned information then please let me know, Thank you.

23 December, 2012

"List from Spreadsheet" using SharePoint Designer 2010 throws "An unexpected error has occurred"



We are all aware about ‘How to import a spreadsheet’ from normal GUI functionality. This time I was playing the same functionality with SharePoint Designer 2010 and faced some challenges. I would like to share the exact steps as how we can reproduce the same error and workaround for the same.

Problem Description: If you try to import a spreadsheet from within SharePoint Designer 2010 to create a list in SharePoint 2010 you get an error

"An unexpected error has occurred."

Steps To Reproduce:
1.     Browse to a SharePoint site 
2.     From the Site Settings menu click on "Edit In SharePoint Designer" 
3.     Within SharePoint Designer, choose left menu "Lists and Items" 
4.     From the Ribbon menu click "List from Spreadsheet" 
5.     SharePoint Designer will launch the SharePoint site within a browser 
6.     Add a title on the list and choose File then click Import 
7.     You will get error message "An unexpected error has occurred" 

Workaround:
The URL when you try to load the page from SharePoint Designer will look something like the following and it will not work:


Append to the URL on the page that is being called from SharePoint Designer with the following and reload the page.

&ListBaseType=0&DisplayName=Spreadsheet+Import  

Example:

If you have any queries/questions regarding the above mentioned information then please let me know. I would be more than happy to help you as well as resolves your issues J J

04 August, 2012

An unexpected error has occurred.

You have a file that has a long file name. When you try to upload this file to a picture library in Microsoft SharePoint Server 2010, you receive the following error message:

An unexpected error has occurred.

Cause:
This problem occurs because the file name exceeds the limit of 125 characters.

Resolution:
To work around this problem, reduce the file name to less than 125 characters, and then re-upload the file.

Please let me know in case of any queries/questions, Thank you.

07 April, 2012

An unexpected error has occurred

When a user tries to add a file to the My Content page, he might encounter this error message. This error can occur when the User Profile service is stopped.

To resolve this error, in Central Administration, do the following:
  1. Click Application Management
  2. In the Service Applications section
  3. Click Manage services on server.
  4. On the Services on Server page
  5. In the User Profile Service row
  6. Click Start.
In case of any queries/information required then please let me know.
I would be more than happy to help you as well as resolves your issues J

17 January, 2012

An unexpected error has occurred

Problem Description:
If you try to import a spreadsheet from within SharePoint Designer 2010 to create a list in SharePoint 2010 then you will get an error

"An unexpected error has occurred."

What exactly I am doing:
1.   Browse to a SharePoint site
2.   From the Site Settings menu click on "Edit In SharePoint Designer"
3.   Within SharePoint Designer, choose left menu "Lists and Items"
4.   From the Ribbon menu click "List from Spreadsheet"
5.   SharePoint Designer will launch the SharePoint site within a browser
6.   Add a title on the list and choose File then click Import
7.   You will get error message "An unexpected error has occurred"

After hours of troubleshooting and debugging, I got this issue resolved by using the following workaround.

Workaround:
1.   The URL when you try to load the page from SharePoint Designer will look something like the following and it will not work:

          http://server/_layouts/new.aspx?ListTemplate=SpreadsheetImport

2.   Append to the URL on the page that is being called from Sharepoint Designer with the following and reload the page.

          &ListBaseType=0&DisplayName=Spreadsheet+Import

Example:

I hope the above mentioned information will help you to resolve your issue. If you have any queries/questions regarding the above mentioned information then please let me know. I would be more than happyJ to help you as well as resolves your issues J J