Friday 23 December 2016

Host Named site collection is not opening

Hosted Site Collection issue
After creating a host header site collection on any web application you will receive following warning and the site collection will not work and get error message of Page not found.

To make this site available follow these steps.
Open IIS manager on the server
 Extend the Server node in left side
 Extend Click on Sites
Right Click on you Web Application that is going to host you new site collection.
Select Bindings
Click on Add
Here select the type as http that you provided while created the site collection, Define the port on which you want to host the site, define the host name as your site collection URL that is sphelpblog.com in my scenario. I am giving port 7686 as this is my web application port.
Now it will be added in bindings as in following screen.
Now Close this wizard
Now go to this location on your server - C:\Windows\System32\drivers\etc
And open host file in notepad.
Add an entry in this file for the new site like IP and hostname
127.0.0.1 “host that we provided in IIS in my scenario it is sphelpbyabhi.com”
Save this file. And restart your machine now this site can be used by your machine
When you open this site in IE you have to add it in your trusted site.

SharePoint Site asking password again and again

Hi All,

Today I am going talk about a very wired behavior of SharePoint.

Issue-
When you are opening a SharePoint site in  Internet Explorer it is asking for user credentials again and again and mostly it is asking for password 3 times and then shows a blank screen. This issue is coming for all the users even also for Site Collection Admin or Farm Administrators. 

Here i will like to mention that i was using a Hosted site collection.

Some trouble shooting i did in my case -

  1. I tried to open this site in Mozila Firefox and Google Chrome and found that site is working fine in both. Sharepoint is simply asking for a user name and password and allowing me to access the site. The difference I noticed here is that, When I am trying to access SharePoint in IE and getting credential prompt at that time it is show that connecting to servername.domain.root.loc while logically it should show site url in that window (as it is doing in Mozila and Chrome). By this step I was sure that we are missing something and it is giving issue with Internet Explorer only.
  2. So I visited different blogs, most of them suggest to add the site in trusted sites, or Local Intranet sites. also suggesting to bypass proxy if we are using but in my case we were not using any proxy. I tried all these stuff but no result. Even I tried to enable Internet Explorer for logging in to site with System credentials but it also did not helped me.
After doing all the above stuff i was again on same page that my site is not opening in IE or also in SharePoint designer.

Resolution -
After doing a lot of research work, I was sure that the issue is coming due to some authentication configuration.
So below are the steps how i solved the issue-
  1. I go to IIS Manager in the wfe servers of SharePoint.
  2. Expend the sites
  3. Selected the Defective site.
  4. Double clicked on Authentication. and click on "Windows Authentication".
  5. Select Provided in the left hand side tool box.
  6. Here you will see two providers "Negotiate" and "NTLM". Here leave NTLM and remove the other one.
  7. Click on "OK" and restart the IIS services.

Now open your site in IE or SharePoint designer and it should work.

Object reference not set to an instance of an object While Creating Site collection

Hi All,

Once I was creating a Site collection and got a strange error message that is "Object reference not set to an instance of an object". While every this was working in our environment but I was continuously getting this error on our Preprod environment. When I did further research and Check ULS Logs, I found following error,
Failed to provision site [project web access instance name] with error: System.NullReferenceException: Object reference not set to an instance of an object. at Microsoft.SharePoint.Administration.SPContentDatabaseCollection.FindBestContentDatabaseForSiteCreation(IEnumerable`1 contentDatabases, Guid siteIdToAvoid, Guid webIdToAvoid, SPContentDatabase database, SPContentDatabase databaseTheSiteWillBeDeletedFrom)

This error can be occur while creating site collection, site, Site backup or restore, or an particular site.

To solve these errors we performed the following steps:
1. Run below powershell command to get GUID of web application.
get-spwebapplication | ? {$_.displayname -eq ” You’re Web Application Name”} | fl
2. Run this SQL query against configuration database.
select ID, Name, CAST (properties as xml) from Objects where ID = ‘Webapplication ID’

And find in the xml which database has a fld of null.
  1. The results returned from step 2 will have 1 column with the properties as xml. Click on the results and it should open a new window in SQL Mgmt studio with xml output.
2.      Search for the word "m_Databases" in the xml output.
  1. Carefully read through the tag that stores the above searched word. You should be able to see fld tags. Find out a tag which has fld tag with value null. This is the orphan database. Its GUID is the xml line above where you found null.
  2. Cross verify all databases currently associated with the web application and make sure this database is not getting used. And check also again in SharePoint PowerShell if it is not listed!
Get-SPWebApplication | %{Write-Output “`n- $($_.url)”; foreach($cd in $_.contentdatabases){Write-Output $cd.name $cd.id “” }}
3.      Run below powershell script,
$webapp=get-spwebapplication "http://site.com"
$webapp.contentdatabases.delete(‘ID-of-bad-content-db’)

This script will give some error message but the null entry will be gone. And you will be able to perform your task.