启动Azure Functions会出现以下异常:
2017-12-19T23:32:29.318 F# HTTP trigger function processed a request.
2017-12-19T23:32:29.504 Exception while executing function: Functions.XYZ. mscorlib: Exception has been thrown by the target of an invocation. mscorlib: Access to the path 'D:\Program Files (x86)\SiteExtensions\Functions\1.0.11388' is denied.
2017-12-19T23:32:29.551 Function completed (Failure, Id=233a8f97-34c9-4eb6-a333-7e3d726c7bac, Duration=698ms)
在我阅读similar question时,我多次重启该功能。
我的函数在F#中并使用FSharp.Data,所以我将它添加到project.json文件
{
"frameworks": {
"net46":{
"dependencies": {
"FSharp.Interop.Dynamic": "3.0.0",
"FSharp.Data": "2.4.3"
}
}
}
}
在我的函数中,我添加了open FSharp.Data
语句。
我认为#r不是必需的,是吗?
知道我能做什么吗? THX
更新
如果触发器触发,则抛出以下异常
F# HTTP trigger function processed a request.
Exception while executing function: Functions.LMWarnungVerbessern
Microsoft.Azure.WebJobs.Host.FunctionInvocationException : Exception while executing function: Functions.LMWarnungVerbessern ---> System.Reflection.TargetInvocationException : Exception has been thrown by the target of an invocation. ---> System.UnauthorizedAccessException : Access to the path 'D:\Program Files (x86)\SiteExtensions\Functions\1.0.11388' is denied.
at System.IO.__Error.WinIOError(Int32 errorCode,String maybeFullPath)
at System.IO.FileStream.Init(String path,FileMode mode,FileAccess access,Int32 rights,Boolean useRights,FileShare share,Int32 bufferSize,FileOptions options,SECURITY_ATTRIBUTES secAttrs,String msgPath,Boolean bFromProxy,Boolean useLongPath,Boolean checkHost)
at System.IO.FileStream..ctor(String path,FileMode mode,FileAccess access,FileShare share)
at FSharp.Data.Runtime.IO.asyncRead@237-5.Invoke(Unit unitVar) at C:\Git\FSharp.Data\src\CommonRuntime\IO.fs : 237
at Microsoft.FSharp.Control.AsyncBuilderImpl.callA@851.Invoke(AsyncParams`1 args)
at Microsoft.FSharp.Control.AsyncBuilderImpl.commit[a](Result`1 res)
at Microsoft.FSharp.Control.CancellationTokenOps.RunSynchronously[a](CancellationToken token,FSharpAsync`1 computation,FSharpOption`1 timeout)
at Microsoft.FSharp.Control.FSharpAsync.RunSynchronously[T](FSharpAsync`1 computation,FSharpOption`1 timeout,FSharpOption`1 cancellationToken)
End of inner exception
at System.RuntimeMethodHandle.InvokeMethod(Object target,Object[] arguments,Signature sig,Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj,Object[] parameters,Object[] arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj,BindingFlags invokeAttr,Binder binder,Object[] parameters,CultureInfo culture)
at async Microsoft.Azure.WebJobs.Script.Description.DotNetFunctionInvoker.InvokeCore(Object[] parameters,Function…
更新2
一旦我使用它就会发生:
let! doc = HtmlDocument.AsyncLoad(url) //same with HtmlDocument.Load
作为一种解决方法,我现在使用WebClient下载它,然后解析文本:
let wc = new WebClient()
let lines = wc.DownloadString url
let doc = HtmlDocument.Parse lines