【问题标题】:F# and Windows AzureF# 和 Windows Azure
【发布时间】:2014-03-01 22:10:10
【问题描述】:

我创建了一个新的 WebAPI 项目,该项目引用了我用 F# 编写的组件。我在本地工作站上工作正常。当我将它部署到 Windows Azure 时,我得到了这个:

<Error><Message>An error has occurred.</Message><ExceptionMessage>Could not load file or assembly 'FSharp.Core, Version=4.3.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.</ExceptionMessage><ExceptionType>System.IO.FileNotFoundException</ExceptionType><StackTrace>   at System.Web.Http.ApiController.<InvokeActionWithExceptionFilters>d__1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__0.MoveNext()</StackTrace></Error>

有人有什么建议吗?我将 F# .dll 设置为复制本地。

【问题讨论】:

    标签: azure f#


    【解决方案1】:

    尽管 F# 是一门出色的语言,但坦率地说,框架支持是一团糟。 FSharp.Core 不附带普通的 .NET 框架,而是作为单独的安装程序(例如 this one, for F# 3.1.1)。从外观上看,Windows Azure 操作系统映像根本没有安装 F#,或者至少没有安装您的代码所针对的版本。

    Here's more information about the F# versioning scheme.

    当所需版本的 FSharp.Core 在目标计算机上不可用时(目前在 Windows Azure 上就是这种情况),您必须在上传的包中包含 FSharp.Core.dll。 Here's more information about running an F# ASP.NET Web API service on Azure. 除其他事项外,您必须确保在 Visual Studio 中正确设置 Build Action

    【讨论】:

      【解决方案2】:

      也将 F# .dll 添加到主 WebAPI 项目中。否则它不会包含在上传到 Azure 的包中。

      【讨论】:

      • 我通过 add...reference 添加了它,但它仍然失败。然后我不得不返回并将其标记为本地副本并且它有效。谢谢你们俩。
      猜你喜欢
      • 2012-04-10
      • 1970-01-01
      • 2011-04-11
      • 1970-01-01
      • 1970-01-01
      • 2012-07-20
      • 1970-01-01
      • 2023-03-20
      • 1970-01-01
      相关资源
      最近更新 更多