hubFS: THE place for F#

. . . are you on The Hub?
Welcome to hubFS: THE place for F# Sign in | Join | Help
in Search

F# and ASP.Net under Medium Trust

Last post 11-07-2008, 4:45 by kullbom. 5 replies.
Sort Posts: Previous Next
  •  10-12-2008, 2:35 7421

    F# and ASP.Net under Medium Trust

    Hello all,

    I am experimenting with F# and Asp.Net and the host I try it with claims that our sites run under Medium Trust with ReflectionPermissions added (among a few other additions) but whatever I do I get a SecurityException from System.Type.GetType - during initialization of the buildmanager(s)...

    I have configured f# to use the FSharpCodeProvider in FSharp.Compiler.CodeDom.dll.

    My hosting company also claims that assemblies without the AllowPartiallyTrustedCallersAttribute are not allowed which I guess is my actual problem since neither FSharp.Core.dll or FSharp.Compiler.CodeDom.dll has that attribute.

    Running the site locally works fine with the two assemblies FSharp.Core.dll and FSharp.Compiler.CodeDom.dll in the Bin directory...

    Has anyone been able to run a F# website on a host under similar conditions under Medium Trust?

    Regards,
    Johan Kullbom
    Johan Kullbom
    http://blog.hoomla.se
  •  10-15-2008, 10:52 7452 in reply to 7421

    Re: F# and ASP.Net under Medium Trust

    Hi,

    This is likely to be because of the use of CodeDom.dll, which requires fsc.exe be installed on the target machine, and which will no doubt require some higher level of priveleges.

    If you are building a production system, our current recommendation based on the CTP bits is to use a C# presentation layer (e.g. a C# web app) with an F# code-behind DLL for your application logic.

    Thanks

    Don

     

  •  10-23-2008, 23:32 7520 in reply to 7452

    Re: F# and ASP.Net under Medium Trust

    Don,

    Thanks for the reply.

    I'll use a C#-web app as you suggest for now (even though the dependency of fsc.exe seems a bit strange to me).

    Regards,
    Johan Kullbom
    Johan Kullbom
    http://blog.hoomla.se
  •  11-07-2008, 2:29 7644 in reply to 7520

    Re: F# and ASP.Net under Medium Trust

    Followup:

    I'm now using a C# web application without code-behind files where the aspx-pages "Inherits" from types defined in a referrenced F#-assembly.

    The referrenced F#-assembly is compiled using "--staticlink FSharp.Core" (under "Project Properties" -> "Build" -> "Other flags").

    I had to manually add references to quite a few framework assemblies (including "Microsoft.VisualC" ??) but once done my site runs fine.

    The site is now plain F# and hosted in a (shared and cheap) Medium Trust environment.

    I am not able to use any inline F# on the pages - will have to use C# for that - but since I never liked that anyway that is not a problem...

    (So far) I much prefer this sollution to using C# in code-behind ...

    Regards,
    Johan Kullbom


    Johan Kullbom
    http://blog.hoomla.se
  •  11-07-2008, 4:21 7647 in reply to 7644

    Re: F# and ASP.Net under Medium Trust

    Thanks for the follow up, sounds great! Just out of interest, what's the site?

    Cheers,
    Rob
    Robert Pickering, MVP
    http://strangelights.com
  •  11-07-2008, 4:45 7649 in reply to 7647

    Re: F# and ASP.Net under Medium Trust

    Robert,

    The site is not public yet but I make sure to post a reference to it here when it becomes so ...

    Regards,

    Johan


    Johan Kullbom
    http://blog.hoomla.se
View as RSS news feed in XML
Powered by Community Server, by Telligent Systems