SharePoint search is returning 500 internal server error page : Resolved

Recently i was working on a Intranet Portal and most part of it was based on documents collaboration. So to easily find a document i configured search for the site. I created a new content source in existing search service application and crawl the source. It was crawled successfully without showing an error or warning, but when i opened the site in IE i was presented by an 500 internal server error page. I tried one more time and same result, i suspect that there is something fishy in IIS (may be application or app pool is stopped). To my surprise there was nothing like that, i reset the IIS but same result. After checking the log file i found this weird entry.

System.Resources.MissingManifestResourceException: Could not find any resources appropriate for the specified culture or the neutral culture.  Make sure “Resources.lutron.core.resources” was correctly embedded or linked into assembly “App_GlobalResources.0whxr_of” at compile time, or that all the satellite assemblies required are loadable and fully signed.    at System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo culture, Boolean createIfNotExists, Boolean tryParents)     at System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo culture, Boolean createIfNotExists, Boolean tryParents)     at System.Resources.ResourceManager.InternalGetResourceSet(CultureInfo culture, Boolean createIfNotExists, Boolean tryParents)     at System.Resources.ResourceManager.GetObject(String name, CultureInfo culture, Boolean wrapUnmanagedMemStream)     at System.Web.Compilation.BaseResXResourceProvider.GetObject(String resourceKey, CultureInfo culture)     at System.Web.Compilation.ResourceExpressionBuilder.GetResourceObject(IResourceProvider resourceProvider, String resourceKey, CultureInfo culture, Type objType, String propName)     at System.Web.HttpContext.GetGlobalResourceObject(String classKey, String resourceKey, CultureInfo culture)     at Microsoft.SharePoint.Search.SPSatelliteResourceExpressionBuilder.GetResource(String classKey, String resourceKey)     at ASP._layouts_accessdenied_aspx.__BuildControlltAccessDeniedCaption()

After sometime i opened the site in Chrome and search was working fine there same was with Firefox. So i thought that there is problem with browser not with SharePoint server. After digging in to IE settings i came to know that there wasn’t any default language set for my IE (Might be i removed this for some testing purpose.)

Every user has a search preference inside SharePoint site and it can be accessed through below link.

http://My_SharePoint_Site/_layouts/EditUserPref.aspx

In this page, by default search language is set as ‘Search using my browser’s language‘. Other option is ‘Search using the following languages (maximum of five)‘. So if the option 1 (default) is selected then there should be a default language set in your browser otherwise you’ll get 500 internal server error.

In case option 2 is selected, then search is not dependent on browser language preference. In my case i just set the browser default language in place of opt for option 2. Below are the steps.

  1. Tools > Internet Options.
  2. Under General tab, click on languages button.
  3. Inside Language Preference window, add a language (in my case it was English (United States) ). If you add multiple languages in this window then the first one will be treated as the default language for browser.

*You can also opt for option 2 mentioned above as per your choice.

Happy SharePointing 🙂

Update custom list’s feature reference | Update custom list’s feature id reference.

Disclaimer: Approach used in this blog post is risky and not recommended. The idea of this post is to just understand the insight and sharing my experience with my blog readers. If still you want to try this for any situation then please do this at your own risk.

We earlier created a custom list using list definitions feature in our site. After one month, we decided that the list definition responsible for list creation had to move to another feature to make the feature as the group of alike lists.

After deployment, we found that list was not being opened and was throwing error. So after digging in to log file, I came to know that list was still pointing to previous feature and now that feature didn’t have the reference for the list schema (As we had already moved the reference to the new feature). I was not ready to take risk of deleting the existing list as it was already contained thousands of referenced items. Deleting the list means to do lots of manual work to fix the functionality and to waste the time and effort.

Now there was only one way that if somehow I could change the reference of existing feature id of list to new feature id. But how that was possible??

I couldn’t found a direct way by using code or Power Shell script to change the feature reference of existing list. So I started analyzing and thought that at least there must be some place where SharePoint keeps this configuration and my mind said content database. Now as you know that SharePoint content database is not a piece of cake to understand and it’s very complex to understand. Everything is based on GUID and referencing is too complex to understand. Due to this complexity, Microsoft doesn’t recommend to touch the content database. But for me there was no other way. So below is how I fixed this issue.

  •  In site content database, there is a table (AllLists) that has all such references. This table keeps the relation information of a custom list and feature related with the list.
  • tp_Title‘ column has the name of list(s) and ‘tp_FeatureId‘ column keeps the feature id related to the specific list.
  • My list name was ‘AnnouncementCategory’ and first I perform the below command.

SELECT *  FROM [AllLists] where tp_Title like ‘%Announce%’

This query gave me all related lists result set. After analyzing the result set I came to know that all other related lists are pointing to same feature id but the problematic list was pointing to different feature id (The previous feature).

  • Now I decided to update the feature id value to see the difference. I noted down the current feature-id value at notepad (In case to revert back the changes) and execute below mentioned update command to update the feature id.

update AllLists set tp_FeatureId=’xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx’ where tp_ID like ‘%xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx%’

tp_FeatureId : This is the feature id of new feature that contains the reference of the existing list. You can get this from your code file (Feature.xml) or from 14 hive (C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\FEATURES).

tp_ID : This is the unique id column in the AllLists table to identify a specific record.

  • After running this command, when I tried to open the problematic list then to my surprise it opened without any error. After that I performed some testing on the list to verify that whether everything is working fine or not.
  • Testing included adding/updating/deleting/content migration and lookup references of list.

For me after spending a couple of hours, it was like bingo. Happy Share Pointing 🙂

Failed to open the default internet browser SharePoint : Resolved

Recently i uninstalled Chrome browser from my machine. After that when i tried to open Central Administration then below mentioned

error popped up as message.
Failed to open the default internet browser. An Internet browser is not  installed or has not been configured to be your default browser
I checked the target of Central Administration and found it was correct i.e. “C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\BIN\psconfigui.exe” -cmd showcentraladmin”

So issue was that Central Administration application was unable to detect default browser. Though i have 2 different browsers on my machine including IE 9.

Below are the steps to fix the issue. Though these steps are specific to Windows 7 but you can use them with any Windows OS.

  1. Go to Control Panel.
  2. Click on “Default Programs“.
  3. Click on “Set your default programs“.
  4. Click “Internet Explorer” under Programs section (Left hand side in Windows 7) and click on “Set this program as default“.

You are done. Happy SharePointing 🙂

Installing assembly in GAC in Windows Server 2008 : Resolved

I developed an event handler and need to deploy it on production server. My production server is built on Windows 2008 Enterprise Server 64 Bit and there was only one installation on server i.e. SharePoint Server 2010. Now I need to install my assembly in to GAC. I copied my .dll to production server. Then I opened c:\windows\assembly and drag drops my assembly in to GAC (c:\windows\assembly folder). But nothing happened and my assembly couldn’t install in GAC 😦

Drag and drop was not working. So second alternative was to use gautil.exe to install the assembly inside GAC but as it was production server so there wasn’t any installation of visual studio and hence there was no SDK installed therefore there wasn’t such exe like gacutil.exe. Again that was a problem. Now I worked on why drag and drop is not working. I searched here and there and follow some articles but nothing helped me. I disable UAC and restart server but it doesn’t work. I opened console and explorer using run as administrator but nothing helped me. Then I copied gacutil.exe file from my development machine to production server but I couldn’t run it (Though lastly this technique worked for me).So finally I resolved this issue and below are the directions for how to resolve this?

1. First check that if production server is of 32 bit or 64 bit?

2. If it is 64 bit then open folder “C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\x64

But if it is 32 bit then open folder “C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin

3. Copy 2 files i.e. gacutil.exe & gacutil.exe.config

4. Paste these files to any location of production server.

5. Your gacutil.exe is now ready to run and u can install assembly in to GAC using this small utility.

 Points to Remember

* When you drag and drop assembly in GAC it won’t give proper error messages (Like targeting framework error) if it has any so better to use gacutil to install assembly.

* gacutil.exe doesn’t run standalone rather it needs a configuration file to run i.e. gacutil.exe.config

Command Line Error by STSADM : Resolved

I was executing a command using stsadm and when I hit enter it was displaying an error stating that “Command Line Error”. Everything was perfect from my end but it was weird to getting this error. So finally I could resolve this. For information how to resolve this find my earlier blog post here.

Though it was for a different problem but resolution of both problems is same.

Enjoy SharePointing……….

Resolved: The given assembly or codebase was invalid error by stsadm command

I was trying to register custom profiledeletehandler by using stsadm command line utility. My command, code and assembly were perfect. But even then when I was trying to execute stsadm then it was displaying “The given assembly or codebase was invalid”.

Humnnn what could be the problem then after doing some research I came to know that I wrote the part of the command in notepad first and then copy/paste this part in command line. OMG, that was some encoding problem while copy/pasting the command.

Though if you delete the stsadm command and retype this in command line console then both (earlier & retyped) will look same. But this was only and major difference and solve the problem.

Solution: Please type the whole command by your own including each and everything.

Moral of the Story:

1. Avoid copy/pasting the stsadm command from other application as you can be the victim of this type of problem.

2. Always do check for PublicKeyToken values (If u are using assembly reference) twice and other spelling mistakes in stsadm command, as it can be the cause of these type of problems.

Create Hierarchies Link in SharePoint Variation Site is not working : Resolved

Problem: Inside variation labels, if we click on create hierarchies button nothing happens.

Scenario: I had a publishing site with variation enabled on a specific port. I backed up the site and restore it on a web site hosted on another server. This new website is on different port. Now i created a new variation label inside new site and after creating variation label, when i clicked on Create Hierarchies button nothing got happen. So i started to search the root cause of this problem. I first open the variation link to check the variation settings and here i found that location in the variation home section was pointed to the old server and settings were disabled. Humnnn it meant that this was the root cause of the problem. So question arises that how to change the settings as i wanted to keep all the sites that were earlier created by using variation hierarchies and using GUI there was no option to reset these settings. After searching Google, i couldn’t find any specific things regarding this. Problem was that linking in variation settings was not appropriate. So after spending lots of hours to fix this problem i came to know that there is a hidden relationship list inside the publishing site that has variation functionality. So after tweaking my site URL i got that list. Below are the steps to fix this problem.

1. Append your root site URL like this “http://testserver:9001/relationships%20list/allitems.aspx“.

2. Relationships List will open and here you will see so many entries of (no title) depending upon the earlier sites created.

3. You have to open and view each item until you find the value “F68A02C8-2DCC-4894-B67D-BBAED5A066F9” against the GroupId column.

4. This item has relation link for variation home site and this value will same for all publishing sites having variations.

5. Edit the item.

6. Against ObjectId column fill the URL of root site e.g. http://testserver:9001

7. Give any title and click on OK button.

8. Come out from that list, create a new variation label and then create hierarchies button.

9. Voilà hierarchies are creating now.

 

Exports excel data to SharePoint custom list with desired column names!

So once again I am back with a blog post…

Today we will see that how to import a spreadsheet inside a custom list with defined columns.

We are ready for production deployment for an application. This application contains the master data for cities all over the world. Client provided us the list of 9000 cities that need to be inserted inside master custom list as we know that 9000 entries will take the hell lot of time to add in the list. So how would I do it within the sort span of time?

The only way that I put all the cities inside an excel and then create a new a custom list by importing that excel. So I start the thing. I create a list using import spreadsheet option but ooopsssss all cities updated inside that custom list but when I look at the column name this shows me like Column1, Column2, etc….

This was very disappointing as this list and columns are used in my custom code, and I don’t want to change my code due to this.

SO QUESTION WAS that I want 9000 entries inside custom list with desired column names…

What to do so below are the steps to do that.

 

  • First open the excel sheet.
  • Paste the data inside excel sheet accordingly you want.
  • Now in the first row put the column name that you want the list column name.
  • Remember that between two columns there should not be any column left blank.
  • Now select first cell of the sheet.
  • Click on Insert tab and then click on the table.
  • It will open a Create table window with the selected range of data.
  • Select my table has headers checkbox then ok.
  • Now your sheet is in a table format, and we are on the way.
  • Now open the site and select on create.
  • Create the custom list using import spreadsheet option
  • Give a name of the list and path of the excel sheet and click on import.
  • It will open the excel sheet and a window.
  • Select cell ranges in the drop down and give the range of the cells.
  • Just import and after completing the process we have a custom list with data and desired column names.

Happy SharePointing 🙂

Resolved: Could not load file or assembly ‘Microsoft.SharePoint.Search, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c’ or one of its dependencies…

I have a solution that contains SharePoint dll’s reference. Whenever I run the solution, start page get crash and show me this error.

“Could not load file or assembly ‘Microsoft.SharePoint.Search, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c’ or one of its dependencies. An attempt was made to load a program with an incorrect format.”

Well every time I run the project it creates Microsoft.SharePoint.Search.dll and Microsoft.SharePoint.Search.xml inside the bin folder and it creates the problem. Well there are lots many things have written on web regarding this problem. I follow all these things but could not get rid of this error. Finally I decided to fix this problem according to my way. So below are the steps to fix this problem permanently.

1.       Inside solution explorer (Visual Studio), select the project and right click on that.

2.       From context menu, click on properties.

3.       When properties page opens, Click on Build Events.

4.       Under Post – build event command line, copy and  paste below lines

cd $(TargetDir)

del Microsoft.SharePoint.Search.dll

del Microsoft.SharePoint.Search.xml

Now save the project, build the project and run. Now above mentioned error will never irritate you. 🙂

Resolved: Run .swf and other MIME type files in web browser in SharePoint 2010 scnerio

One fine day i migrate a SharePoint portal of a client from MOSS 2007 to SharePoint 2010. Well as usual i face so many problems during migration and after migration. This was the one problem i face after migration. It was interesting so i decide to share this with you guys.
Well there was a training site in MOSS 2007 and this site contains a document library that in addition contains some demo .swf files. Client put a view of this library on training site home page. So whenever any one click on any demo files, this runs on browser. Well after successful migration of this site to SharePoint 2010 i decide to test this site. During testing when i clicked on a .swf demo file then in place of running in browser it asked me to download the file. This was problematic to me as client want this site to run on browser only not to download it and he want exactly what it was behaving in MOSS 2007. I checked for Blocked File Types, Shock-wave plug-in installation on browser, mime type added in IIS. But with no luck as all settings was perfectly fine and on same machine and browser MOSS 2007 training site was perfectly running. I thought about the security issue and permission but i was partially right coz i was the site collection administrator and had the full permission so permission was not the problem. But definitely it was due to security, so i searched for relative security settings and after some research i came to know about the new setting provided in SharePoint 2010 for web applications and it was “Browser File Handling”. Well below are the steps that how i resolved this:
1. Open Central Administration Site.
2. On left hand menu, click on Application Management.
3. In “Web Applications” section, Click on “Manage web applications” link.
4. Select the desired application by clicking on it.
5. Now on the Ribbon menu (Top Menu), Click on General Settings Icon arrow. A pop up will open, in this pop up select General Settings.
6. Another pop up page will open, scroll down the page and go to “Browser File Handling” section.
7. In my case by default it was set to strict. I change this setting to Permissive.
8. Click OK and it was done.

Now i open my SharePoint 2010 training site and clicked on a demo .swf file and voila this time it didn’t ask me to download rather it played on browser as it played in MOSS 2007 site.

Note:
“Browser File Handling”
Specifies whether additional security headers are added to documents served to web browsers. These headers specify that a browser should show a download prompt for certain types of files (for example, .html) and to use the server’s specified MIME type for other types of files.
Permissive Specifies no headers are added, which provides a more compatible user experience.
Strict Adds headers that force the browser to download certain types of files. The forced download improves security for the server by disallowing the automatic execution of Web content that contributors upload.