Monday, October 29, 2007

Runtime Error while opening Sharepoint Site

Before starting discussion, I would like to Thanks Uday Microsoft MVP for Sharepoint for sharing his knowledge in solving the error.

Runtime Error while opening Sharepoint Site

Or do you recieve following error.

Runtime Error

Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed.

Details: To enable the details of this specific error message to be viewable on the local server machine, please create a tag within a "web.config" configuration file located in the root directory of the current web application. This tag should then have its "mode" attribute set to "RemoteOnly". To enable the details to be viewable on remote machines, please set "mode" to "Off".

<!-- Web.Config Configuration File -->

<configuration>
<system.web>
<customErrors mode="RemoteOnly"/>
</system.web>
</configuration>


Cause of Error
There can be more ways this error can trouble, but let me share how this error occur while working with sharepoint.

My PC, is one of the workgroup PC to connect to local network. Now to take advantage of sharepoint and to make it sharepoint server, I have turned my PC to Domain Controller and Installed Active Directory using DCPromo Command on command prompt.

What is Domain Controller?
Domain Controller is first PC in network which controls sub domain.
Example: DailyFreeCode.com can be said Domain Controller, while sub domain such as Forums.DailyFreeCode.com and Search.DailyFreeCode.com are domain under the domain controller, for more details and indepth knowledge please refer "Active Directory Concept" and "Domain Creation Concept" in windows 2003 server.

How to turn your PC to Domain Controller?
You can make your PC to Domain Controller on Windows 2003 Server by running command "DCPromo" on command prompt. A wizard will open which guide you step by step in creating your PC to Domain Controller.

Ok, so now back to our problem.

It was obvious that after creating your PC to Domain Controller this error is likely to occur as default setting are changed and that also need to configure.


Solution for Error
  • Note: I haven't considered steps for backup data.
  • Remove SQL Server with UnInstalling all Instances.
  • Remove MOSS.
  • Remove Virtual Directory from InetMgr (IIS) related to Sharepoint.
    • Sharepoint Central Administration
    • Office Server Web Services...
  • Remove directory from c:\inetpub\wwwroot\wss\Virtual Directories and delete all directories under it.
    • Remove directory "80" and so on...
  • Note: I have also deleted directory not deleted while MS SQL Server and also remove it from Registry. i.e. from HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSSQLServer\
  • Restart PC.
  • Install MS SQL Server
  • Restart PC
  • Install MOSS 2007
  • Restart PC
  • Run Configuration Wizard of MOSS
  • And Try opening sharepoint website, now it should work for you.
Please pass your comment and suggestion to improve this steps as each time it not possible to delete all data, and it is also necessary to take backup before applying above step, so share your experience, Thanks.

4 comments:

Andrew T-S said...

Hi

We also experienced this issue on our QA server at a Clients offices, there is a way to fix this without doing a complete

uninstall and re-install.
The cause is still open to debate, but a developer was working on one of the user controls in the IIS wwwroot folder.
After the issue became known the changes where undone, but this not fix the issue.

OK, firstly do a backup, SQL, Site collection.
as for my experience this issue does not affect the data, just some configuration info.
So if you do a site collection backup you will have a full copy of all up to date changes.

In the stsadm.exe folder in command prompt use this command to do a site collection backup.
stsadm -o backup -Filename D:\backups\Sitecollection.bak -URL http://servername

Allow the backup to complete.

Connect to the central administration page on the system.
Goto the Application management page choose the 'Delete Web Application' item
Ensure you select the web application that is giving the error.
Select 'Yes' to the Delete content DB, and leave 'No' selected for the IIS site
Hit Delete
The web application will be deleted.

Reset IIS if asked to

Now return back to the Application management page and select the "Create or extend Web application' link
Click the 'Create a new Web application'
The normal port for the default SharePoint app is on port 80, now that is the one that is broken, and since we did not delete

the IIS site on port 80
we will create a new IIS web site on another free port example port 120
So fill in the IIS site name, the port
Leave the Host header field blank
Fill in any other info as needed
Click OK and the web application will be created.

Reset IIS if asked to

Now return back to the Application management page and select the 'Create Site Collection' link
Select the newly created site collection, enter in a title and name (this is just to test so anything will do)
Fill in the rest of the details as needed
Click Ok

Reset IIS if asked to

Browse to the newly created site collection
http://servername:120
the default basic site will be loaded.

Now on the actual server, open IIS, expand the Web Sites section
goto the web application we created, right click and open the properties
The web Site Properties are displayed.
In the Web Site Identification section, there is an Advanced button, click it
In the Multiple Indentities for this web site section there should only be one entry, IP address is Default, TCP port will be

120, host header will be blank
Click the Add button to create a new entry
leave the IP Address as all Unassigned
TCp port type in 80
Host header value will be the server name, just the server name no http://
If you have a custom sharepoint address like http://intranet.company.co.za then just type in 'intranet.company.co.za'

(obviously without the '')
Bearing in mind that you have to have the appropriate changes in DNS for that to work!

Click OK until you get back to the default IIS page

Reset IIS

Now go back to the Central Administration page, open the Operations tab
Select the Alternative Access mappings under the Global Configuration
here you will have a listing of the Internal URLs, Public URLS etc
select the URL of the Web App & the Site collection we created on port 120.
We have changed it in IIS and now we must tell SharePoint that it has been changed.
So click on the URL of the created site on port 120.

In the URL Protocol, host and port field edit the field from http://servername:120 to http://servername (or the Custom name)

Reset IIS

Now if you hit the normal server sharepoint address the system will load up the basic SharePoint page.
Now we can do a site collection restore.

On the server open up a command prompt window, navigate to the folder that has the STSADM.exe file in it
We will no do a site collection restore

stsadm -o restore -Filename D:\backups\Sitecollection.bak -URL http://servername -overwrite

Allow some time for this to run

once the restore has run, and gives you a successful message,

Open up an IE window type in the server address, and your content is back.
If however the site collection restore did complete successfully and the data is not listed in the site, run the site
collection restore again (I have had a few occassions where the site collection restore did not take 100%, re-ran it and
it came right!)

Note!
For Developers, if any changes need to be made in the config file or anything else that normally would be done in the port 80

folder
in IIS would now need to be made in the port 120 folder.
Although we have told IIS to forward the requests from 80 to 120 and SPS is remapped to goto port 80 for that web app, the

files still
reside in the 120 folder, on my server it is
C:\Inetpub\wwwroot\wss\VirtualDirectories\120

This procedure has worked for me let me know if you have any success with it

Himani Sharma said...

HI

try to give write access\ to the logged in user to the following folder C:\windows\Microsoft.NET\Framework\v2.0.50727.

Nathan Andersen said...

The comment from Andrew is irrelevant. If your central admin site is returning the server error then you can not use central admin to delete any web applications. He's answering a completely different problem.

Also, this article is not particularly helpful. Completely wiping your machine and starting over is a poor answer and one that we can all arrive at ourselves.

So. I just had this error in server application when I went to central admin for the first time after running the installer & sharepoint configuration wizard. Here's how I got it working, your mileage may vary:

My problem was that my database access account was not an admin on any of the machines in my farm. From my documentation I didn't think that account needed to be but I was wrong.

I went ahead and made that account domain admin. Doesn't follow rule of least priveleges so depending on your security concerns you may want to dial access down a bit to local admin on the SQL box & the application server(s).

Then under add or remove programs, I selected Microsoft Office Sharepoint Server, and the repair option. In the repair wizard, I kept all of my settings the same (keep central admin on the same machine, etc.). After the repair wizard I rebooted. Then I ran the sharepoint configuration wizard again, keeping all the settings the same. It completed successfully, and Central Admin launched.

Considerably faster than wiping the machines & starting over.

Edwin said...

Thank you very much, i do exactly what you wrote and works fine , im from bolivia south america, and i try to find the solution in others blogs but this one is the most quickly and secure, than again

Most Recent Post

Subscribe Blog via Email

Enter your email address:



Disclaimers:We have tried hard to provide accurate information, as a user, you agree that you bear sole responsibility for your own decisions to use any programs, documents, source code, tips, articles or any other information provided on this Blog.
Page copy protected against web site content infringement by Copyscape