Search code examples
c#-4.0iis-7.5openrasta

OpenRasta w/ .Net 4.0 running under Win 7 64 with IIS7.5


I am trying to follow along with the getting started OpenRasta application. https://github.com/openrasta/openrasta-stable/wiki/Building-Your-First-OpenRasta-Website

I am using .Net4 under windows 7 64 bit, and I am targeting IIS 7.5. I have set my Active Configuration to Debug, and my Platform to Any CPU. The version of OpenRasta I am using is 2.0.3.

Here is the error I get: "Could not load file or assembly 'OpenRasta.Hosting.AspNet' or one of its dependencies. The system cannot find the file specified. "

I suspect it has something to do with OpenRasta being compiled for .net35 and not 4? I have tried a number of different approaches to fix this but I am still stuck.

I changed the application pool settings to set Enable 32 bit Applications = true, and here is the web.config I am using:

    <?xml version="1.0"?>
<configuration>
    <system.diagnostics>
        <switches>
            <add name="ShowErrors" value="4"/>
        </switches>
        <!-- log to debug output -->
        <sources>
            <source name="OpenRasta" switchValue="All">
                <listeners>
                    <add name="TextWriterListener" type="System.Diagnostics.TextWriterTraceListener" initializeData="Logs\OpenRasta.txt"/>
                </listeners>
            </source>
        </sources>
    </system.diagnostics>
    <system.web>
        <compilation debug="true" targetFramework="4.0">
        </compilation>
        <authentication mode="None"/>
        <!-- required for WebForms views -->
        <pages pageParserFilterType="OpenRasta.Codecs.WebForms.OpenRastaPageParserFilter, OpenRasta.Codecs.WebForms, Version=2.0.1.0, Culture=neutral" controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID">
            <namespaces>
                <add namespace="OpenRasta.Web"/>
                <add namespace="OpenRasta.Web.Markup"/>
                <add namespace="OpenRasta.Codecs.WebForms"/>
                <add namespace="OpenRasta"/>
                <add namespace="System.Collections.Generic"/>
            </namespaces>
        </pages>
        <!-- hook into OpenRasta -->
        <httpHandlers>
            <add verb="*" path="*.rastahook" type="OpenRasta.Hosting.AspNet.OpenRastaHandler, OpenRasta.Hosting.AspNet, Version=2.0.1.0, Culture=neutral"/>
        </httpHandlers>
        <httpModules>
            <add name="RastaModule" type="OpenRasta.Hosting.AspNet.OpenRastaModule, OpenRasta.Hosting.AspNet, Version=2.0.1.0, Culture=neutral"/>
        </httpModules>
    </system.web>
    <system.codedom>
        <compilers>
            <compiler language="c#;cs;csharp" extension=".cs" warningLevel="4" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" compilerOptions="/warnaserror-">
                <providerOption name="CompilerVersion" value="v4.0"/>
                <providerOption name="WarnAsError" value="false"/>
            </compiler>
        </compilers>
    </system.codedom>
    <!-- iis7 config -->
    <system.webServer>
        <validation validateIntegratedModeConfiguration="false"/>
        <!-- hook into OpenRasta -->
        <modules>
            <add name="OpenRastaModule" type="OpenRasta.Hosting.AspNet.OpenRastaModule, OpenRasta.Hosting.AspNet"/>
        </modules>
        <handlers>
            <add name="OpenRastaHandler" verb="*" path="*.rastahook" type="OpenRasta.Hosting.AspNet.OpenRastaHandler, OpenRasta.Hosting.AspNet, Version=2.0.1.0, Culture=neutral"/>
        </handlers>
    </system.webServer>
</configuration>

Any help would be greatly appreciated! Perhaps there is a .net 4 build of openrasta out there that I just can not find?


Solution

  • Ok, I fixed this one. I followed the debugging advice on the output and set my registry to show assembly bind failures. [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.

    This allowed me to see where it was looking for the assembly. Turns out the output folder for the project was set to some weird path and not bin/ Once I set it to bin/ I was able to get past this error. Thank you to everyone for taking the time to read this