<legend id='hHWoz'><style id='hHWoz'><dir id='hHWoz'><q id='hHWoz'></q></dir></style></legend>
    • <bdo id='hHWoz'></bdo><ul id='hHWoz'></ul>

      <tfoot id='hHWoz'></tfoot>
      <i id='hHWoz'><tr id='hHWoz'><dt id='hHWoz'><q id='hHWoz'><span id='hHWoz'><b id='hHWoz'><form id='hHWoz'><ins id='hHWoz'></ins><ul id='hHWoz'></ul><sub id='hHWoz'></sub></form><legend id='hHWoz'></legend><bdo id='hHWoz'><pre id='hHWoz'><center id='hHWoz'></center></pre></bdo></b><th id='hHWoz'></th></span></q></dt></tr></i><div id='hHWoz'><tfoot id='hHWoz'></tfoot><dl id='hHWoz'><fieldset id='hHWoz'></fieldset></dl></div>

      <small id='hHWoz'></small><noframes id='hHWoz'>

    1. Azure Functions - 无法从 Azure WebJobs SDK 调用

      Azure Functions - can#39;t be invoked from Azure WebJobs SDK(Azure Functions - 无法从 Azure WebJobs SDK 调用)
        <bdo id='w1KGi'></bdo><ul id='w1KGi'></ul>

      • <i id='w1KGi'><tr id='w1KGi'><dt id='w1KGi'><q id='w1KGi'><span id='w1KGi'><b id='w1KGi'><form id='w1KGi'><ins id='w1KGi'></ins><ul id='w1KGi'></ul><sub id='w1KGi'></sub></form><legend id='w1KGi'></legend><bdo id='w1KGi'><pre id='w1KGi'><center id='w1KGi'></center></pre></bdo></b><th id='w1KGi'></th></span></q></dt></tr></i><div id='w1KGi'><tfoot id='w1KGi'></tfoot><dl id='w1KGi'><fieldset id='w1KGi'></fieldset></dl></div>
          <tbody id='w1KGi'></tbody>

        <small id='w1KGi'></small><noframes id='w1KGi'>

        <tfoot id='w1KGi'></tfoot>
        1. <legend id='w1KGi'><style id='w1KGi'><dir id='w1KGi'><q id='w1KGi'></q></dir></style></legend>

                本文介绍了Azure Functions - 无法从 Azure WebJobs SDK 调用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                所以我一直在尝试创建一个简单的 azure 函数,这将是一个 http 触发器CreateUser".
                我做了另一个 http 触发器来简化问题,它看起来相当简单:

                So I've been trying to create a simple azure function, that would be an http trigger "CreateUser".
                I did an other http trigger to simplify what's wrong, it looks fairly simple :

                using System.Net;
                using System.Net.Http;
                using System.Threading.Tasks;
                using Microsoft.Azure.WebJobs;
                using Microsoft.Azure.WebJobs.Extensions.Http;
                using Microsoft.Azure.WebJobs.Host;
                
                namespace TutoTableAzureTemplate
                {
                    public static class TestTrigger
                    {
                        [FunctionName("TestTrigger")]
                        public static async Task<HttpResponseMessage> Run([HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route =  null)]HttpRequestMessage req, TraceWriter log)
                        {
                            return req.CreateResponse(HttpStatusCode.OK, "This request arrived succcesfully");
                        }
                    }
                }
                

                这在模拟器上运行,给我带来以下错误:

                This, running on the emulator, brings me the following error :

                Error indexing method 'TestTrigger.Run'. Microsoft.Azure.WebJobs.Host: Cannot bind parameter 'log' to type TraceWriter. Make sure the parameter Type is supported by the binding.
                

                (我的模拟器版本是5.3)
                我试图删除参数TraceWriter log,并且函数运行"很好......直到我使用Postman向它发送一个http请求,这带来了一个关于WebJobs的错误:

                (My emulator's version is 5.3)
                I tried to remove the parameter TraceWriter log, and the function "runs" fine... until I send it an http request using Postman, which brings an error about WebJobs :

                "System.InvalidOperationException : 'TestTrigger' can't be invoked from Azure WebJobs SDK. Is it missing Azure WebJobs SDK attributes? ... "
                

                我想知道该属性是否是导致上一个问题的 TraceWriter log 以及是否有办法将其带回此处...

                哦,顺便说一句,我进入了某种地狱般的版本冲突,出于某种原因,我不得不使用 .NET Standard 2.0 而不是我之前使用的 .NET 461,按照教程建议.
                这是我的 .csproj :

                I'm wondering if the attribute is the TraceWriter log that caused the previous problem and if there is a way to bring it back here...

                Oh and by the way, I entered some kind of version conflicts of hell, and for some reason, had to go with .NET Standard 2.0 instead of .NET 461, which I was previously using, along the tutorial suggestion.
                Here is my .csproj :

                <Project Sdk="Microsoft.NET.Sdk">
                  <PropertyGroup>
                    <TargetFramework>netstandard2.0</TargetFramework>
                  </PropertyGroup>
                  <ItemGroup>    
                    <PackageReference Include="Microsoft.NET.Sdk.Functions" Version="1.0.13" />
                    <PackageReference Include="Microsoft.Azure.Storage.Common" Version="9.0.0.1-preview" />
                    <PackageReference Include="Microsoft.Azure.CosmosDB.Table" Version="1.1.1" />
                  </ItemGroup>
                  <ItemGroup>
                    <Reference Include="Microsoft.CSharp" />
                  </ItemGroup>
                  <ItemGroup>
                    <None Update="host.json">
                      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
                    </None>
                    <None Update="local.settings.json">
                      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
                    </None>
                  </ItemGroup>
                </Project>
                

                "Microsoft.Azure.CosmosDB.Table" 显然在 .NET Standard 2.0 中不可用,并且 .NET 461 版本在这里恢复,但这只是一个警告"......和Microsoft.Azure.Storage.Common" 仅提供预览版.

                这可能与某个地方的某个版本有关,但我在所有使用不同东西的教程中迷失了自己,而且由于我对 Azure 还很陌生,我不知道发生了什么......

                "Microsoft.Azure.CosmosDB.Table" is apparently not available in .NET Standard 2.0, and the .NET 461 version is restaured here, but "it's only a warning"... and "Microsoft.Azure.Storage.Common" is only on preview.

                This probably have to do with a version of something somewhere, but I lost myself in tutorials that all used different stuff, and since I'm fairly new to Azure, I don't know what' happening...

                推荐答案

                出于某种原因,我不得不按照教程建议使用 .NET Standard 2.0 而不是我之前使用的 .NET 461.

                for some reason, had to go with .NET Standard 2.0 instead of .NET 461, which I was previously using, along the tutorial suggestion.

                似乎当您创建 azure function initial 时,您的函数是 .NET 461,出于某种原因,您将其更改为 .NET Standard 2.0.

                It seems that when you create azure function initial, your function is .NET 461 and for some reason, you change it to .NET Standard 2.0.

                但是,当您的函数是 .NET Standard 2.0 时,您的运行时版本应设置为 beta.

                However, when your function is .NET Standard 2.0, your runtime version should be set to beta.

                所以在你的.csproj中添加AzureFunctionsVersion,因为默认的.NET 461 runtime是1,当你改成.NET core时,你需要把runtime改成手动beta".

                So add AzureFunctionsVersion in your .csproj, because the default .NET 461 runtime is 1 and when you change to .NET core, you need to change the runtime to "beta" manually.

                您可以参考以下代码:

                <PropertyGroup>
                    <TargetFramework>netstandard2.0</TargetFramework>
                    <AzureFunctionsVersion>v2</AzureFunctionsVersion>
                  </PropertyGroup>
                

                这篇关于Azure Functions - 无法从 Azure WebJobs SDK 调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                Populate ListBox with a IEnumrable on another thread (winforms)(在另一个线程(winforms)上使用 IEnumrable 填充 ListBox)
                listbox selected item give me quot; System.Data.DataRowViewquot; , C# winforms(列表框选择的项目给我quot;System.Data.DataRowView, C# Winforms)
                Cannot remove items from ListBox(无法从列表框中删除项目)
                Preventing ListBox scrolling to top when updated(更新时防止列表框滚动到顶部)
                Drag and drop from list to canvas on windows phone with MVVM(使用 MVVM 在 Windows 手机上从列表拖放到画布)
                Deselection on a WPF listbox with extended selection mode(具有扩展选择模式的 WPF 列表框上的取消选择)
                  <legend id='PGh6z'><style id='PGh6z'><dir id='PGh6z'><q id='PGh6z'></q></dir></style></legend>
                  <i id='PGh6z'><tr id='PGh6z'><dt id='PGh6z'><q id='PGh6z'><span id='PGh6z'><b id='PGh6z'><form id='PGh6z'><ins id='PGh6z'></ins><ul id='PGh6z'></ul><sub id='PGh6z'></sub></form><legend id='PGh6z'></legend><bdo id='PGh6z'><pre id='PGh6z'><center id='PGh6z'></center></pre></bdo></b><th id='PGh6z'></th></span></q></dt></tr></i><div id='PGh6z'><tfoot id='PGh6z'></tfoot><dl id='PGh6z'><fieldset id='PGh6z'></fieldset></dl></div>
                  <tfoot id='PGh6z'></tfoot>

                    <tbody id='PGh6z'></tbody>
                    • <bdo id='PGh6z'></bdo><ul id='PGh6z'></ul>

                      <small id='PGh6z'></small><noframes id='PGh6z'>