草庐IT

azure-pipelines-build-task

全部标签

c# - 从 Azure Websites for Google API 中的 p12 证书生成 X509Certificate2 时出现 502 错误

我正在使用ThisGoogleJsonWebToken类以生成访问token,以与对GoogleCalendarAPI的json调用一起使用。当我使用以下内容(使用我的实际服务帐户电子邮件)时,它在我的开发机器上的IISExpress中工作得很好:stringp12Path=HttpContext.Current.Server.MapPath("~/App_Data/certificate.p12");varauth=GoogleJsonWebToken.GetAccessToken("uniquestring@developer.gserviceaccount.com",p12Pat

c# - 调试 AzureFunction 以及部署 azure 函数时缺少 ProviderName

我在获取DbContext以从我的local.settings.json正确提取连接字符串时遇到问题上下文:这是一个Azure函数项目主要问题代码在System.Data.Entity.Internal.AppConfig虽然我有一个local.settings.json文件,但这不是dotnet核心。这是.net4.6.1错误信息:'Theconnectionstring'ShipBob_DevEntities'intheapplication'sconfigurationfiledoesnotcontaintherequiredproviderNameattribute."'Jso

c# - 我可以将 Task.Delay 用作计时器吗?

我想每秒执行一些代码。我现在使用的代码是:Task.Run((Action)ExecuteSomething);ExecuteSomething()定义如下:privatevoidExecuteSomething(){Task.Delay(1000).ContinueWith(t=>{//Dosomething.ExecuteSomething();});}这个方法会阻塞线程吗?或者我应该在C#中使用Timer类吗?似乎Timeralsodedicatesaseparatethreadforexecution(?) 最佳答案 Tas

c# - 使用 Windows Azure DiagnosticsMonitor 时,log4net traceappender 仅记录级别为 'verbose' 的消息

我有一个azureworker角色,我已将其配置为使用写入WindowsAzure.Diagnostics的log4netTraceAppender。这是通过在worker角色的RoleEntryPoint中进行以下调用来完成的。usingSystem;usingMicrosoft.WindowsAzure.Diagnostics;usinglog4net.Config;namespaceXXX{publicclassWorkerRole:RoleEntryPoint{publicoverrideboolOnStart(){varconfig=DiagnosticMonitor.Get

c# - 尝试在 : await Task. 之外捕获 Run(()

在awaitTask.Run(()=>之外的trycatch是否有意义,或者仅在await内部使用它们?privateasyncvoidTest(){try{awaitTask.Run(()=>{try{DoingSomething();}catch(Exceptionex){log.Error(ex.Message);}});}catch(Exceptionex){log.Error(ex.Message);}} 最佳答案 如果你处理Exception在委托(delegate)内部(在您的情况下仅用于记录目的),await在正常情

c# - 在 Visual Studio Online Build Definition 中从具有多个 Web 项目的解决方案构建一个 Web 项目

我遇到一个问题,我需要从一个在VisualStudioOnline中包含两个Web项目的解决方案构建一个Web项目。我还没有找到如何使用“VisualStudioBuild”步骤仅构建一个项目。如果存在通过“VisualStudio构建”步骤执行此操作的方法,那就太好了。我还尝试使用“MSBuild”步骤。不幸的是,我在使用Nuget恢复包时遇到了问题。我收到错误:##[error]未找到文件格式header,##[error]从工具NuGet.exe返回意外退出代码1。运行后立即:Nuget.exe恢复Myproj.csproj。总结:如何在VisualStudio在线构建定义中从具

c# - await Task.CompletedTask 是为了什么?

我使用WindowsTemplateStudio创建了UWP应用程序在Build2017上引入的。下面的类是它生成的代码的一部分。publicclassSampleModelService{publicasyncTask>GetDataAsync(){awaitTask.CompletedTask;//();data.Add(newSampleModel{Title="Loremipsumdolorsit1",Description="Loremipsumdolorsitamet",Symbol=Symbol.Globe});data.Add(newSampleModel{Title=

c# - 为什么 Task.WhenAny 没有抛出预期的 TimeoutException?

请注意以下简单代码:classProgram{staticvoidMain(){varsw=newStopwatch();sw.Start();try{Task.WhenAny(RunAsync()).GetAwaiter().GetResult();}catch(TimeoutException){Console.WriteLine("Timedout");}Console.WriteLine("Elapsed:"+sw.Elapsed);Console.WriteLine("PressEntertoexit");Console.ReadLine();}privatestaticas

c# - System.Threading.Tasks 中的 NullReferenceException 调用 HttpClient.GetAsync(url)

我的MVC4.0应用程序有一个奇怪的问题。我使用REST网络服务(AmazonAssociate)。我创建了一种方法,可以在任何地方使用。缩短版是这样的:privateasyncTaskGetRequest(stringurl){stringmyresponse;HttpResponseMessageresponse=null;HttpClientclient=newHttpClient();try{response=awaitclient.GetAsync(url);myresponse=response.Content.ToString();if(myresponse.Contai

c# - 将正文添加到与 azure 服务 mgmt api 一起使用的 HttpWebRequest

我将如何添加到HttpWebRequest的主体?正文需要由以下组成base-64-encoded-configuration-filetrue|falseAuto|Manual非常感谢任何帮助 最佳答案 byte[]buf=Encoding.UTF8.GetBytes(xml);request.Method="POST";request.ContentType="text/xml";request.ContentLength=buf.Length;request.GetRequestStream().Write(buf,0,buf