2014-03-01 50 views
3

我創建了一個新的WebAPI項目,它引用了我在F#中編寫的組件。我在本地工作站上工作正常。當我將它部署到Windows Azure時,我收到了以下內容: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#.dlls設置爲複製本地。

回答

1

也將F#.dlls添加到主WebAPI項目中。否則,它不會包含在上傳到Azure的包中。

+0

我添加它通過添加...參考,它仍然失敗。然後,我不得不回去並將其標記爲本地副本,並且工作正常。感謝你們倆。 –

4

雖然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中正確設置構建動作