Had another interesting one today whilst trying to deploy locally during a CI build using MSDeploy, I kept getting the error:

Exception calling "SyncTo" with "4" argument(s): "Connected to the destination computer ("localhost") using the Web Management Service, but could not authorize. Make sure that you are using the correct user name and password, that the site you are connecting to exists, and that the credentials represent a user who has permissions to access the site."

I wanted to use integrated security but the Web Management service just wasn't playing.  So I found that you just need to enable NTLM in the registry:

  • Navigate to HKEY_LOCAL_MACHINE\Software\Microsoft\WebManagement\Server
  • Create a new DWord key called "WindowsAuthenticationEnabled"
  • Set it's value to 1
  • Restart the Web Management Service


When deleting a service using the syntax: sc delete tcbuildagent you might come across the error:

The specified service has been marked for deletion

This is an easy one to fix and no need to reboot, just close down the services window or server manger!


Posted in: Windows 2008  Tags:
Admin posted on October 30, 2011 17:25

I'm currently looking at implenting sitesearch for one of my client sites, I looked at a few options including Microsoft's Search Server Express 2010 and a commercial solution from http://www.sitesearchasp.net.

Here's my results:

Microsoft Site Search Express 2010

In a nutshell I a spent about half a day trying to get this working, don't waste your time with this crap (being polite as possible) as it's an absolute nightmare.  It's quite a big install and it actually installs SharePoint 2010 as well which I didn't particually want.

See the following blog posts on the "hacks" required to get it working on a non domain server:
http://soerennielsen.wordpress.com/2010/07/15/how-to-install-a-sharepoint-2010-complete-server-without-ad/
http://www.trinkit.com/blog/2009/4/9/the-sharepoint-search-service-and-anonymous-access

After doing all of this I still couldn't get it working with a nice error from Sharepoint:

At this point with nothing sensible coming form the logs I lost the will to live, deleted everything and am currently trying to delete the thought of SharePoint  from my memory.  Lets move on....

 

SiteSearchAsp.Net

Report coming soon....

 


Posted in: ASP.NET MVC , Windows 2008  Tags:

Whilst looking at implementing a site search feature for one of my client sites I thought I'd look at Microsoft's free Search Server 2010 Express to see if I can use it to crawl my MVC3 razor website that I'm working on.  

First of all I'd try to install Search Server 2010 but quite quickly found that if you don't have a domain account then you'll receive the following error:
"the account must be a valid domain account"

Thanks that's really useful!  I came across this excellent article which with a bit of PowerShell allows you to work around the problem by:

1.  After install cancel the SharePoint configuration wizard
2.  Drop down to the SharePoint Management Shell
3.  Run New-SPConfigurationDatabase
2.  Now you're good to go with the wizard by running PSConfigUI



As with most of my Windows 2008 administration scripts I prefer to only "touch" the system if it needs updating otherwise leave it alone.  The script below shows how to detect if a service is set to manual, change to automatic and start if required.  Oddly the Get-Service cmdlet doesn't return the start type in PowerShell 2.0 for some reason.  

 

 function SetServiceStartToAutoMatic($serviceName = $(throw "Service Name was not specified")){  
      $service = Get-Service $serviceName  
      $startType = Get-WmiObject -Query "Select StartMode From Win32_Service Where Name='$($serviceName)'"  
   
      if ($startType.StartMode -eq "Manual"){  
           Set-Service $serviceName –StartupType Automatic  
      }  
 }  
   
 function StartServiceIfStopped($serviceName = $(throw "Service Name was not specified")){  
      $service = Get-Service $serviceName  
      if ($service.Status -eq "Stopped"){  
           Start-Service $serviceName  
      }  
 }  
   
 function Main(){  
      $smtpServiceName = "SMTPSVC"  
      SetServiceStartToAutoMatic $smtpServiceName  
      StartServiceIfStopped $smtpServiceName  
 }  
   
 Main  

 


I had a nice error on a Windows 2008 R2 server whilst trying to install some server roles/features with PowerShell:

 Import-Module servermanager  
 Get-WindowsFeature  

Resulted in error:

   
 Get-WindowsFeature : Failed to initialize.  
 At line:3 char:19  
 + Get-WindowsFeature <<<<   
   + CategoryInfo     : OperationStopped: (:) [Get-WindowsFeature], COMException  
   + FullyQualifiedErrorId : DiscoveryFailed,Microsoft.Windows.ServerManager.Commands.GetWindowsFeatureCommand  

You might also see this error when opening the Windows 2008 Server Manager Roles or an exception code 0x800B0100.  

The fix:

- Download and install the System Update Readniess Tool: http://support.microsoft.com/kb/947821/en-us
 -When prompted install the KB patch/fix.


Admin posted on October 11, 2011 12:50

Here's a PowerShell script that determines if the OS is Windows Server 2008 and enables a list of windows features.  To get a list of features and enabled status run Get-WindowsFeature (after importing the  servermanager module).

 

 Import-Module servermanager  
   
 function IsWindows2008(){  
   $operatingSystem = gwmi win32_operatingSystem | select name  
   return $operatingSystem.name.contains("Server 2008")  
 }  
   
 function EnableWindowsFeatures($featureList) {  
   foreach ($feature in $featureList) {  
     $featureInfo = Get-WindowsFeature $feature  
     if (!$featureInfo.installed){  
       Add-WindowsFeature $feature  
     }  
   }  
 }  
   
 function Main() {  
   if(IsWindows2008){  
     $features = "Web-Windows-Auth", "Web-Asp-Net"  
     EnableWindowsFeatures $features  
   }  
 }  
   
 Main  
   

I'm currently looking at integrating Sonar into our build environment which intially didn't go too well interms of installation so I thought I'd document what I did and what was required for future reference.  In this first part I will show you how to configure Sonar to run with a basic out of the box setup that uses the inbuilt Derby database, localhost web and Core/Squid C# plugins.

PREREQUISITES - VERY IMPORTANT!

  1. Download Java JDK, it's works with 1.5+ but I installed 1.7.  
    http://www.oracle.com/technetwork/java/javase/downloads/java-se-jdk-7-download-432154.html

INSTALL SONAR

  1. Download Sonar:
    http://sonar.codehaus.org/downloads/
  2. Extract to a directory i.e. c:\Sonar
  3. Run \bin\windows-x86-32\StartSonar.bat or \bin\windows-x86-64\StartSonar.bat depending on your OS
  4. Navigate to http://localhost:9000 to view the default console

    At this point Sonar is configured to use the default database.

CONFIGURE SONAR WITH VS2010

  1. Download the "C# Plugins Ecosystem" 
    - Version 1.0 http://docs.codehaus.org/download/attachments/201228384/CSharpPluginsEcosystem-1.0-RC2.zip
    (Lastest version can be found on the top right here: http://docs.codehaus.org/display/SONAR/C-Sharp+Plugins+Ecosystem)
  2. Extract to the plugins directory C:\Sonar\sonar-2.9\extensions\plugins

INSTALL JAVA RUNNER

Rather than using Mavern it's much easier to to use the Java Runner to kick off Sonar.

  1. Download the Java Runner: http://docs.codehaus.org/display/SONAR/Analyse+with+a+simple+Java+Runner#AnalysewithasimpleJavaRunner-Installation
  2. Extract to dir i.e. c:\Sonar\sonar-runner-1.1
  3. Modify C:\Sonar\sonar-runner-1.1\conf\sonar-runner.properties to enble the default site and Derby DB
    My modifed file looks like this:

     #----- Default directory layout  
     sources=src/main/java  
     tests=src/test/java  
     binaries=target/classes  
     sonar.sourceEncoding=UTF-8  
     #----- Default Sonar server  
     sonar.host.url=http://localhost:9000  
     #----- Global database settings  
     sonar.jdbc.username=sonar  
     sonar.jdbc.password=sonar  
    
  4. Make sure you have the following environment varaibles:
    JAVA_HOME = C:\Program Files\Java\jdk1.6.0_23
    SONAR_RUNNER_HOME = C:\Sonar\sonar-runner-1.1
  5. Add the sonar runner bin path to your PATH environment (for my install this is C:\Sonar\sonar-runner-1.1\bin)
  6. There are two ways to tell Sonar where your .sln file is located
    a) You can create a sonar-project.properties file in the same directory as your solution file, Sonar will find it OR
    b) Create a sonar-project.properties file but use the sonar.dotnet.visualstudio.solution.file property to specify the path (this is my prefered option)
  7. Create a file called "sonar-project.properties" as descrivbed in the above step (literally as it is don't replace project with your project name!) placing it 
    Here's my sample properties file located on the root of my application:

    AppName
    ---->BuildTools
    ---->Lib
    ---->src
    --------->AppName.sln
    build.proj
    sonar-project.properties
  8.    
     # Project identification  
     sonar.projectKey=DMG:AppName
     sonar.projectVersion=1.0-SNAPSHOT  
     sonar.projectName=AppName
       
     # Info required for Sonar  
     sources=.  
     sonar.language=cs  
       
     #Core C# Settings  
     sonar.dotnet.visualstudio.solution.file=\src\\AppName.sln  
       
     #Gendarme  
     sonar.gendarme.assemblies=\build\\DmgTech*.*  
     sonar.gendarme.mode=skip  
       
     # Gallio  
     sonar.gallio.mode=skip  
       
     # FXCop  
     sonar.fxcop.mode=skip  
       
     #StyleCop  
     sonar.stylecop.mode=skip  
       
    
  9. To run Sonar-Runner against your project
    - Shell out to DOS
    - Change directory to the location of your "sonar-project.properties" file
    - Execute "sonar-runner"
  10. View your reports at http://localhost:9000

Troubleshooting
  • If you receive something like: Fail to connect to database: undefined method `getActiveRecordDialectCode' for nil
    Check the JDK version you are running
  • If you receive a maintenance warning then try http://localhost:9000\setup
  • View the logs \logs\sonar.log
  • If you receive the following error make sure the path to Java is in the environment path (I had to put C:\Program Files\Java\jdk1.7.0\bin).  To test head to DOS and type java.
FATAL  | wrapper  | 2011/08/22 13:00:04 | Critical error: wait for JVM process failed
STATUS | wrapper  | 2011/08/22 13:02:14 | --> Wrapper Started as Service
STATUS | wrapper  | 2011/08/22 13:02:14 | Launching a JVM...
INFO   | jvm 1    | 2011/08/22 13:02:16 | Wrapper (Version 3.2.3) http://wrapper.tanukisoftware.org
INFO   | jvm 1    | 2011/08/22 13:02:16 |   Copyright 1999-2006 Tanuki Software, Inc.  All Rights Reserved.

-----------------------------------------------------------------------------------------------------------------------------------

wrapper  | --> Wrapper Started as Console
wrapper  | Java Service Wrapper Community Edition 3.3.0
wrapper  |   Copyright (C) 1999-2008 Tanuki Software, Inc.  All Rights
Reserved.
wrapper  |     http://wrapper.tanukisoftware.org
wrapper  |
wrapper  | Launching a JVM...
jvm 1    | WrapperManager: Initializing...
jvm 1    | 2009-12-07 16:33:29.166::INFO:  Logging to STDERR via
org.mortbay.log.StdErrLog
jvm 1    | 2009-12-07 16:33:29.211::INFO:  jetty-6.1.17
jvm 1    | 2009-12-07 16:33:29.350::WARN:  Failed startup of context
org.mortbay.jetty.webapp.WebAppContext@635f44d4{/,null}
jvm 1    | java.lang.NullPointerException

fix: I came across this error when I reinstalled Sonar over an existing installation, I had to remove and reinstall from fresh to get around this error

-----------------------------------------------------------------------------------------------------------------------------------

 

Exception in thread "main" org.sonar.batch.bootstrapper.BootstrapException: org.picocontainer.PicoLifecycleException: PicoLifecycleException: method 'public void org.sonar.batch.index.DefaultIndex.start()', instance 'org.sonar.batch.index.DefaultIndex@39da8a, java.lang.RuntimeException: wrapper at org.sonar.runner.Runner.delegateExecution(Runner.java:155) at org.sonar.runner.Runner.execute(Runner.java:58)at org.sonar.runner.Main.main(Main.java:52)
Caused by: org.picocontainer.PicoLifecycleException: PicoLifecycleException: method 'public void org.sonar.batch.index.DefaultIndex.start()', instance 'org.sonar.batch.index.DefaultIndex@39da8a, java.lang.RuntimeException: wrapper

 

FIX: sonar-runner can't find a sonar-project.properties file!

In the next part I'll dive into enabling the extra plugins such as Gallio and incorporate NCover reports. 

 


Calendar

«  May 2012  »
MoTuWeThFrSaSu
30123456
78910111213
14151617181920
21222324252627
28293031123
45678910
View posts in large calendar

Recent Comments

Banners

Theme Grabber
Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2012 Dan Gibbons .Net Developer