Posts Tagged ‘Launch’

Set default document for IIS via web.config at Silverlight Web project

When you tell the Visual Studio IDE to generate a web project (instead of just using an autogenerated page) for a Silverlight project, it creates a project named SilverlightAppName.Web with a SilverlightAppNameTestPage.aspx ( and an SilverlightAppNameTestPage.html. Either one can be served from a web server (obviously the .aspx one from IIS or any web server that supports at the server-side) to run the Silverlight app in the browser, or for debugging from within Visual Studio (with the included test web server [Cassini] or IIS).

Note that at that Web project’s Properties, there’s a tab Silverlight applications, where Silverlight apps hosted by that Web project are listed. If you add more there, Visual Studio will generate respective pages for them, in the pattern mentioned above.

By right clicking one of those two pages you can select “Set as Start Page” to set the default page that “Start” or “Start without debugging” uses. However that setting isn’t replicated to the web.config file automatically so that after publishing (by right clicking the web project and selecting “Publish”) that Web project to say a subfolder under “wwwroot” of IIS (or deeper in the web folders hierarchy).

If it was doing so, you would be able to just visit that folder and have IIS (or any other web server that supports the web.config scheme) serve the wanted page as the default document (instead of showing a can’t browse folder error or displaying the folder contents if Directory Browsing has been enabled at IIS console for that folder or some ancestor of it [and has not been overridden to disable at that folder])

However, you can edit web.config yourself to achieve that, like below:

<?xml version="1.0"?>
<!--   For more information on how to configure your ASP.NET application, 
please visit   --> <configuration>
    <compilation debug="true" targetFramework="4.0" />
       <clear />
        <add value="
SilverlightAppNameTestPage.aspx" />


Launching MATLAB with no UI (headless) for remote automation

I’m sharing here an answer I just gave at:

for archiving, since this may interest fellow Roboticists

Launching MATLAB on a server without the GUI is covered thoroughly at
you should also read the user comments/discussion there

e.g. you can use

start matlab -nosplash -nodesktop –nojvm –noFigureWindows -minimize -r


The –noFigureWindows parameter is mentioned at
where it doesn’t mention –nodesktop (only the UNIX doc mentions it for X-Windows), however it seems you have to use it on Windows too, else you see the MATLAB code editor window too popup.


I’m not sure the –nojvm works at all on Windows version of MATLAB, it’s not mentioned in the official documentation URL mentioned above and also Process Monitor tool from Microsoft SysInternals shows that MATLAB still loads it’s internal Java VM’s files even with that command-line parameter provided.

If not using Java is too restrictive for your needs:

Regarding -nodesktop vs. -nojvm, there is a third
(undocumented/unsupported) option: ‘-noawt’. -noawt loads Java (thus
enabling Java I/O, data structures etc.) and just prevents Java GUI


Also note that when launching MATLAB from a WCF service, even if you set an AppPool to run the service under a custom account (say MATLABUSER) and even if you set the Matlab current directory / search path for that user (Matlab keeps them separately for each Windows user account), it keeps on ignoring them. Thus you are forced to use “-sd” deprectated command-line parameter of Matlab (mentioned at the official doc URL I sited above) to set the startup path of Matlab. In that folder you can have a “startup.m” file where you use ADDPATH command of Matlab to temprorarily update the Matlab startup path for the running Matlab process.

ADDPATH Add directory to search path.
    ADDPATH DIRNAME prepends the specified directory to the current
    matlabpath.  Surround the DIRNAME in quotes if the name contains a
    space.  If DIRNAME is a set of multiple directories separated by path
    separators, then each of the specified directories will be added.
    ADDPATH DIR1 DIR2 DIR3 …  prepends all the specified directories to
    the path.

Unfortunately the “-sd” command-line parameter is deprecated, which means it could be removed in the future, but the Matlab online documentation fails to list alternatives, just says “For information about alternatives, see .” and nothing more there:

matlab -sd "startdir" specifies the startup directory for MATLAB (the current directory in MATLAB after startup). The -sd option has been deprecated. For information about alternatives, see .


BTW, instead of launching MATLAB via Windows shell command you could launch as a COM automation server:

or via existing C API for launching MATLAB:


If you use this often (e.g. from a web service), it is best that you keep an instance of MATLAB in memory all the time (since Windows apps for example share code and have separate data this can spare much time by avoiding the reloading of MATLAB code into memory at every script run). That instance could be headless too (with no UI) using this command at server boot (e.g. by adding an entry at HKLM/Software/Microsoft/Windows/CurrentVersion/Run in the Windows registry using "regedit.exe"):

start matlab -nosplash -nodesktop –nojvm –noFigureWindows -minimize

%d bloggers like this: