Saturday, January 19, 2008

Hosts file getting deleted

Today, I modified the search indexer to point to a seperate wfe server instead of crawling all the wfe's. Once I modifed the setting, the following error started throwing up in the eventviewer:

Reason: Could not find file 'C:\WINDOWS\system32\drivers\etc\HOSTS'.

Event Type: Error
Event Source: Office SharePoint Server
Event Category: Office Server Shared Services Event ID: 6482
Date: 1/19/2008
Time: 6:12:03 AM
User: N/A
Computer: ******************
Description:Application Server Administration job failed for service instance Microsoft.Office.Server.Search.Administration.SearchServiceInstance Reason: Access to the path 'C:\WINDOWS\system32\drivers\etc\HOSTS' is denied.
Techinal Support Details:

System.UnauthorizedAccessException: Access to the path 'C:\WINDOWS\system32\drivers\etc\HOSTS' is denied. at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy) at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options) at System.IO.StreamWriter.CreateFile(String path, Boolean append) at System.IO.StreamWriter..ctor(String path, Boolean append, Encoding encoding, Int32 bufferSize) at System.IO.StreamWriter..ctor(String path, Boolean append) at System.IO.FileInfo.CreateText() at Microsoft.Search.Administration.Security.HOSTSFile.CleanupDedicatedGathering(Hashtable HOSTSFileMappings, StringBuilder HOSTSComments, IEnumerable obsoleteHosts, String dedicatedName, Boolean isDirty) at Microsoft.Search.Administration.Security.HOSTSFile.ConfigureDedicatedGathering(SearchServiceInstance searchServiceInstance, SPServer dedicatedWebFrontEndServer, IList`1 previousWebApplicationHostNames) at Microsoft.Office.Server.Search.Administration.SearchServiceInstance.SynchronizeDefaultContentSource(IDictionary applications) at Microsoft.Office.Server.Search.Administration.SearchServiceInstance.Synchronize() at Microsoft.Office.Server.Administration.ApplicationServerJob.ProvisionLocalSharedServiceInstances(Boolean isAdministrationServiceJob)

The above error shows up because the Sharepoint Timer job actually deletes the hosts file after you modify the wfe the crawler has to point to. I had taken a backup of file and I went ahead and restored it. But after restoring it back, the following error throws up in the eventviewer:

Reason: Access to the path 'C:\WINDOWS\system32\drivers\etc\HOSTS' is denied.

Event Type: Error
Event Source: Office SharePoint Server
Event Category: Office Server Shared Services
Event ID: 6482
Date: 1/19/2008
Time: 6:22:50 AM
User: N/A
Computer: ******************
Description:Application Server Administration job failed for service instance Microsoft.Office.Server.Search.Administration.SearchServiceInstance
Reason: Access to the path 'C:\WINDOWS\system32\drivers\etc\HOSTS' is denied.
Techinal Support Details:System.UnauthorizedAccessException: Access to the path 'C:\WINDOWS\system32\drivers\etc\HOSTS' is denied. at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.FileInfo.Delete() at Microsoft.Search.Administration.Security.HOSTSFile.CleanupDedicatedGathering(Hashtable HOSTSFileMappings, StringBuilder HOSTSComments, IEnumerable obsoleteHosts, String dedicatedName, Boolean isDirty) at Microsoft.Search.Administration.Security.HOSTSFile.ConfigureDedicatedGathering(SearchServiceInstance searchServiceInstance, SPServer dedicatedWebFrontEndServer, IList`1 previousWebApplicationHostNames) at Microsoft.Office.Server.Search.Administration.SearchServiceInstance.SynchronizeDefaultContentSource(IDictionary applications) at Microsoft.Office.Server.Search.Administration.SearchServiceInstance.Synchronize() at Microsoft.Office.Server.Administration.ApplicationServerJob.ProvisionLocalSharedServiceInstances(Boolean isAdministrationServiceJob)


The following permissions need to be given to c:\Windows\System32\Drivers\etc folder for the wss_admin_wpg account :

  • Traverse Folder / Execute File
  • List Folder / Read Data
  • Read Attributes
  • Read Extended Attributes
  • Create Files / Write Data
  • Read Permissions
  • Delete Permissions ( I will explain this .....)

The delete permission also needs to be given because the timer job actually deletes and recreates the hosts file. I was a bit hesitant to give this but had to do so to get it to work. After the permissions are given, I did not see any other errors in the eventlog

Later..

Wednesday, January 16, 2008

Query.TotalRowsExactMinimum Property

Do you want to know what 'Query.TotalRowsExactMinimum' Property does ? Check it out here.....

http://msdn2.microsoft.com/en-us/library/microsoft.office.server.search.query.query.totalrowsexactminimum.aspx
There is no way one can understand what exactly it means ? Please let me know if someone knows what exactly it means.

Saturday, January 12, 2008

Phili code camp 2008.1

I just got back from Code camp and it was great. I started to blog using my IPhone and somewhere in middle, I lost interest to blog and therefore after the third session, you will not find anything except the session titles. I will update them later sometime. Also, please bear with me for the formatting of the text as it was done from an IPhone and right now I am really tired to make any changes....

Session 1:
Test driven development for T-SQL code
Write your test first and then the code.
Write the function that returns data.
Check that the function returns expected data.
How to deal with constraints?
Instead of directly dealing with the table with constraints, create a view that deals with a dummy table without any constraints. Create a procedure to change the table name. But obviously the production view cannot point to a dummy view.This is one of the disadvantages of using a dummy table. Also this would work only for unit testing and not integration testing.ETL would not work in this case either.Always execute your tests after code changes.
Naming: ut_testcasename
use suite of tests

Session 2:
Visual studio 2005 tools and add ins
vs express does not support add ins
command monitor
csproj files are really msbuild files
msbuild sidekick, a third party tool helps with msbuild
Enterprise library helps with basic application blocks
VSTO - visual ribbon and other add INS from vstudio
Resharper - grays out things not being used, helps with error detection and intellisense.It needs to be licensed.
T4 tool helps with color coding the template, use the *tt *t4 extensions.
Zenocode postbuild: .net obfuscator
Reflector: decompiler
Project line counter: specific projects,exlude designer autogenerated code.
Smart paster: paste as string or paste as comments or paste as region
Visual local history: slick tool for version historyFilecompare: Beyond compare
Enlarging tool tips: Tools --> Options --> Font & Colors -->Editor tool tip

Session 3:Sharepoint backup and restore
Session 4:
Exception handling
Session 5:
AJAX and Silverlight

Session 6:
AJAX and Sharepoint

Wednesday, January 9, 2008

Login failed for user 'YourUserName'. The user is not associated with a trusted SQL Server connection.

I was trying to add a new user to one of the databases and it was throwing me this error:

Login failed for user 'YourUserName'. The user is not associated with a trusted SQL Server connection.

I had seen this error before, but was not able to quickly realise the reason for the failure. I had created a sql server login, then a database user and finally mapped the sql server login to the database. The roles for the user were also set properly.

It was the sql server authentication modes. SQL Server was configured for only Windows authentication and not SQL authentication. Once SQL Server authentication was enabled, it worked fine. I had to reset the password after enabling SQL Server authentication mode.

Sunday, January 6, 2008

Taare Zameen Par (Indian Hindi movie)

This is one of the best Indian movies ever made. No wonder Aamir Khan is called "The Perfectionist".
Its a story of a young dyslexic kid (Ishaan), portrayed beautifully by Darsheel Safary. The story unfolds with Ishaan being hunted by the dancing letters (as called by Ishaan for his difficulties with decoding words). He lives in his own world inspite of the rigorous wordly competition and hence lags behind in studies and gets taunted both at home and school. Despite his pleas, his parents move him to a boarding school and eventually he looses interest in his best expertise, Painting. The way the director handled the emotions of Ishaan is worthy a praise and you will be able to recognize the character. You will laugh with him, sail through his canvas and also cry with him (not once but many times). Nikumbh (played by Aamir himself) is the new art teacher at the boarding school and it doesn't take him too much time to recognize Ishaan's problems. Being a dyslexic himself, he tries to explain to Ishaan's parents about their son's problem and also his great painting talent. He also goes the extra mile of helping Ishaan to overcome his problems in a very creative way. I will stop here without going further, as you should watch it to know the ending.

As I walked out of the theater, I could see fathers hugging their sons with affection. Most of them were wiping their tears while walking towards their cars.....

Links:
http://www.taarezameenpar.com/

Tuesday, January 1, 2008

Resetting search index error

I was trying to reset the search index on my dev box and the following error message comes up while doing so:

The application is unable to accept further updates because the last attempt to persist the state failed.

Checking the event logs show up following messages:

Unable to Reset search application 'Shared Services'. Microsoft.Office.Server.Search.Administration.DatabaseException: Unable to persist changes to the search application object due to a previous error persisting changes. See event log for more information on the cause. Only read operations are possible until the issue is resolved. ---> System.Runtime.InteropServices.COMException (0x80040DBA): The application is unable to accept further updates because the last attempt to persist the state failed. See the event log for more details. at Microsoft.Office.Server.Search.Administration.MSSITLB.IGatherApplication2.ValidateVersionForWrite(Int32 lLastVersion, Int32& plVersionOut) at Microsoft.Office.Server.Search.Administration.SearchApi.WriteAndReturnVersion(CodeToRun`1... .. remoteCode, VoidCodeToRun localCode, Int32 versionIn) --- End of inner exception stack trace --- at Microsoft.Office.Server.Search.Administration.SearchApi.WriteAndReturnVersion(CodeToRun`1 remoteCode, VoidCodeToRun localCode, Int32 versionIn) at Microsoft.Office.Server.Search.Administration.SearchApi.ResetApp(Int32 versionIn) at Microsoft.Office.Server.Search.Administration.SearchApi.ResetApp()

To fix it, I tried the following steps:
  • Operations -> Services on server -> Office Sharepoint Server Search - > stop
  • Started the service again
  • SSP site -> search settings
  • Here you need to associate the SSP with the search database
  • Once its done, go back to the search settings page and wait for sometime for the indexer to complete its job (probably 2-3 minutes)
  • Now the search index can be reset.

Happy new year

Wish you all a very happy and prosperous new year !