We are excited to announce that the IIS.NET Forums are moving to the new Microsoft Q&A experience. Learn more >

Relative paths for processPathRSS

2 replies

Last post Oct 26, 2015 02:21 PM by rramachand21

  • Relative paths for processPath

    Feb 09, 2015 01:13 PM|afscrome|LINK

    All the examples Iv'e seen require the use of absolute paths when configuring the path to the executable to run with the Http Platform Handler, but what are the recommendations around using relative paths?  I'd prefer to use relative paths so we can keep all the dependencies self contained in a single package to simplify deployment.

    For example, to run the ~/App_Data/solr_Startup.cmd, I'd have expected to be able to use

                   <httpPlatform
    			processPath="cmd.exe"
    			arguments="/C App_Data\solr_startup.cmd"
    			startupTimeLimit="30" 
    			startupRetryCount="1" 
    			stdoutLogEnabled="false"
    		/>

    However this doesn't work (seemingly because it looks for c:\Windows\system32\app_data\solr_startup.cmd )

    As a hack, I've been able to use powershell to use the application pool configuration file in the %App_Pool_Config% environment variable and the %App_Pool_Id% variable, although it will fall down if you have multiple sub applications using the same id

    		<httpPlatform
    			processPath="powershell.exe"
    			arguments="-Command &quot;
    $config = [xml](gc $env:APP_POOL_CONFIG);
    
    $path = $config.configuration.{system.applicationHost}.sites.site.application |
    	? ApplicationPool -eq $env:APP_POOL_ID |
    	select -ExpandProperty virtualDirectory |
    	select -ExpandProperty physicalpath |
    	% {[Environment]::ExpandEnvironmentVariables($_) };
    
    $path = Join-Path $path App_Data\solr_startup.cmd |
    	? { Test-Path $_};
    
    Start-Process $path;
    &quot;"
    			startupTimeLimit="30" 
    			startupRetryCount="1" 
    			stdoutLogEnabled="false"
    		/>

  • Re: Relative paths for processPath

    Oct 26, 2015 02:20 PM|rramachand21|LINK

    This is supported in v1.2

  • Re: Relative paths for processPath

    Oct 26, 2015 02:21 PM|rramachand21|LINK

    A relative path starts with a . (dot) and is relative to the site root.