Note: Forums will be making significant UX changes to address key usability improvements surrounding search, discoverability and navigation. To learn more about these changes please visit the announcement which can be found HERE.

Locked AppFabric connection string error

  • Thursday, May 31, 2012 7:17 AM
     
      Has Code

    Hi, here's my script

    $connectionstringname = 'monitoringdb'
    $MonitoringLevel = "HealthMonitoring"
    
    $dbdata = Initialize-ASMonitoringSqlDatabase –Database $DatabaseName –Admins "dom\group1" –Readers "dom\group2" –server $ComputerName –Writers "dom\group3"
    
     Add-WebConfigurationProperty -pspath 'MACHINE/WEBROOT' -filter "connectionStrings" -name "." -value @{connectionString=($dbdata.ConnectionString);name=$ConnectionStringName}
    
     Set-ASAppMonitoring -MonitoringLevel $MonitoringLevel -ConnectionStringName $ConnectionStringName -Root
    
    

    And then I get error at Set-ASAppMonitoring:


    Cannot find connection string named 'monitoringDB'. Check the configuration and try again.

    Using  get-webconfiguration -filter connectionstrings | select -expand collection

    I can see monitoringDB and default localsqlserver, and when I use localsqlserver as connection string name then set-asappmonitoring works well

    Where can be the problem?

All Replies

  • Friday, June 01, 2012 7:46 AM
     
     

    Found the cause of error:

     Add-WebConfigurationProperty -pspath 'MACHINE\WEBROOT'  -filter "connectionStrings" -name "." -value @{connectionString=($builder.ToString());name=$ConnectionStringName;providername="System.Data.SqlClient"}

    is not the same as

    appcmd set config /clr:4 /commit:WEBROOT /section:connectionStrings /+"[connectionString='$connectionString',name='$name',providerName='$providerName']"

    Can somebody explain the difference?

  • Thursday, June 07, 2012 9:52 PM
    Moderator
     
     

    I am not sure the first one will put in the property in the same config as the second one. The second one specifies CLR version but it looks like the first one does not. I have not tried running the PowerShell commands myself though.

    Thanks,


    If this answers your question, please use the "Answer" button to say so | Ben Cline

  • Friday, June 08, 2012 7:33 AM
     
     

    Do You know a way to force using clr 4 with Powershell command?

    Is it possible? for now i Found 2 ways of reaching this config: by appcmd and by directly modyfing xml