Run Dream under IIS 6

MindTouch Dream contains a System.Web.HttpHandler to process requests and send them into the Dream environment without the need for running an external executable (mindtouch.host.exe). Below are some steps to configure the HttpHandler for IIS6.  Note, these steps are specific to Windows 2003 Server, though XP isn't much different

Create a virtual directory

  • create a new virtual directory (/@api for example) pointing to your dream directory:  C:/dev/dream/src
  • Access Permissions:  check Read, Execute (such as ISAPI applications or CGI)
  • right-click the vdir and select Properties
  • on the Virtual Directory tab, click Configuration
  • on the mappings tab, remove all Application extensions
  • add a new Wildcard application map:  Executable = C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll   (make sure to UNCHECK "Verify that file exists" checkbox).  This ensures that all requests will be sent to the ASP.NET runtime and handled by MindTouch.Dream.Http.HttpHandler

Setup your web.config

* change the log4net settings in your web.config file so logs aren't created in the bin/ directory. We don't want to write to the bin directory since modifying a file there causes the AppDomain to be unloaded and a new AppDomain to be created.  This causes the HttpHandler (and therefore the DreamEnvironment) to be reinitialized for every singe request.

* create a folder named "logs" in your dream directory (ex: c:\dev\dream\src\logs)

* set the security settings so the NETWORK SERVICE account has all permissions to that folder

* change your log4net settings in web.config to something like:

<appender name="RollingFile-trace" type="log4net.Appender.RollingFileAppender, log4net">
	<file value="logs\trace.log" />
	<appendToFile value="true" />
	<maximumFileSize value="100KB" />
	<maxSizeRollBackups value="2" />
	<layout type="log4net.Layout.PatternLayout">
		<conversionPattern value="%date [%thread] %-5level %logger - %message%newline" />
	</layout>
</appender>

Verification

* go to: http://localhost/dream/host/@about to verify that Dream is running properly

Running a Script

mindtouch.host.exe has a script argument which allows you to load additional services into the Dream runtime. MindTouch.Dream.Http.Http­Handler allows you to do the same thing by specifying the script in the appSettings portion of your web.config.

For example, if you'd like to run the 8ball service (from the Dream samples directory), you'd copy the following files to your c:\dev\dream\src\bin dir

  • dream.sample.8ball.dll
  • 8ball.startup.xml
­

Then create a web.config like this:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <configSections>
        <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
    </configSections>

    <appSettings>
        <add key="service-dir" value="c:\dev\dream\src\bin" />
        <add key="root-uri" value="http://localhost/dream"/>
        <add key="apikey" value="12345"/>
        <add key="script" value="c:\dev\dream\src\bin\8ball.startup.xml"/>
    </appSettings>

    <system.web>
        <httpHandlers>
            <add verb="*" path="*" 
                  type="MindTouch.Dream.Http.HttpHandler, mindtouch.core"/>
        </httpHandlers>
    </system.web>

    <system.net>
        <connectionManagement>
            <add address="*" maxconnection="16" />
        </connectionManagement>
    </system.net>

    <log4net>
        <appender name="RollingFile-trace" type="log4net.Appender.RollingFileAppender, log4net">
            <file value="logs\trace.log" />
            <appendToFile value="true" />
            <maximumFileSize value="100KB" />
            <maxSizeRollBackups value="2" /> 
            <layout type="log4net.Layout.PatternLayout">
                <conversionPattern value="%date [%thread] %-5level %logger - %message%newline" />
            </layout>
        </appender> 
        <appender name="RollingFile-info" type="log4net.Appender.RollingFileAppender, log4net">
            <threshold value="INFO" />
            <file value="logs\info.log" />
            <appendToFile value="true" />
            <maximumFileSize value="100KB" />
            <maxSizeRollBackups value="4" />
            <layout type="log4net.Layout.PatternLayout">
                <conversionPattern value="%date [%thread] %-5level %logger - %message%newline" />
            </layout>
        </appender> 
        <appender name="RollingFile-warn" type="log4net.Appender.RollingFileAppender, log4net">
            <threshold value="WARN" />
            <file value="logs\warning.log" />
            <appendToFile value="true" />
            <maximumFileSize value="100KB" />
            <maxSizeRollBackups value="4" /> 
            <layout type="log4net.Layout.PatternLayout">
                <conversionPattern value="%date [%thread] %-5level %logger - %message%newline" />
            </layout>
        </appender> 
        <appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender">
            <layout type="log4net.Layout.PatternLayout">
                <conversionPattern value="%date [%thread] %-5level %logger - %message%newline" />
            </layout>
        </appender>
        <appender name="OutputDebugStringAppender" type="log4net.Appender.TraceAppender" >
            <layout type="log4net.Layout.PatternLayout">
                <param name="ConversionPattern" value="%date [%thread] %-5level %logger - %message%newline" />
            </layout>
        </appender> 
        <!-- Set root logger level to DEBUG and its only appender to A1 -->
        <root>
            <level value="DEBUG" />
            <appender-ref ref="RollingFile-trace" />
            <appender-ref ref="RollingFile-info" />
            <appender-ref ref="RollingFile-warn" />
            <appender-ref ref="ConsoleAppender" />
            <appender-ref ref="OutputDebugStringAppender" />
        </root>
    </log4net>
</configuration>

You can verify that the 8ball services is loaded by going to:

http://localhost/dream/8ball/@about
Tag page
You must login to post a comment.
Powered by MindTouch Deki Enterprise Edition v.8.08 RC2