创建了 Powershell Azure 函数并尝试在该函数应用程序下使用“az”命令。根据docs,函数运行时应该解析“az”和其他模块依赖项。但这对我不起作用。
错误:术语“az”未被识别为 cmdlet、函数、脚本文件或可运行程序的名称。检查名称的拼写,或者如果包含路径,请验证路径是否正确,然后重试。Microsoft.Azure.WebJobs.Script.Rpc.RpcException:结果:错误:术语“az”未被识别为 cmdlet、函数、脚本文件或可运行程序的名称。
我想在不手动上传模块的情况下在函数应用程序下运行一些“az”命令。是 powershell 预览版问题还是我需要纠正的问题?
要求.psd1
@{
Az = '2.*'
}
Run Code Online (Sandbox Code Playgroud)
有什么方法/技巧/解决方法可以降低 Azure Application Insight 成本吗?我每天都会摄入大量数据(大约 20M)。数据采样设置为 5%,即使在 Application Insights 中每日提取 5GB 数据之后也是如此。
Application Insights 默认保留期为 90 天,但即使 7 天后我也不需要数据。
注意:我仅在应用程序见解中发送包含最少信息的信息日志。
任何人都可以检查下面的代码,让我知道为什么我总是假的(User.Identity.IsAuthenticated)?? 我正在我的浏览器上正确地获取cookie并且能够从Claim获得价值,但"User.Identity.IsAuthenticated"总是错误的.
public async Task<IActionResult> Login(string phoneNumber, int otp, string returnUrl)
{
if (this.accountService.ValidateOTP(phoneNumber, otp))
{
var claims = new List<Claim>
{
new Claim(ClaimTypes.MobilePhone, phoneNumber),
new Claim(ClaimTypes.Name, phoneNumber)
};
var userIdentity = new ClaimsIdentity();
userIdentity.AddClaims(claim);
ClaimsPrincipal userPrincipal = new ClaimsPrincipal(userIdentity);
await HttpContext.Authentication.SignOutAsync("MyCookieMiddlewareInstance");
await HttpContext.Authentication.SignInAsync("MyCookieMiddlewareInstance", userPrincipal,
new AuthenticationProperties
{
ExpiresUtc = DateTime.UtcNow.AddMinutes(20),
IsPersistent = false,
AllowRefresh = false
});
if (string.IsNullOrWhiteSpace(returnUrl))
{
return RedirectToAction("Create", "Ad");
}
else
{
return Redirect(returnUrl);
}
}
return BadRequest();
}
Run Code Online (Sandbox Code Playgroud)
我将应用程序洞察与 API 管理结合使用来监控我的 API。Application Insights 是一个很棒的工具,但我看不到正文。
我想查看 Post 请求正文参数。有什么方法可以在应用程序洞察中添加身体数据吗?
我是“ NoSQL”领域的新手,最近我开始将Cosmos DB用于JSON文档,并且能够使用CosmosDB“ SQL”和“ Mongo” API来存储和获取数据。
哪种API最适合我?(要求:性能,低延迟,大量收集,低成本)
我想按需处理数百万条记录,大约需要 2-3 个小时来处理。我想要无服务器,这就是为什么尝试持久功能(第一次)。我想检查一下,我可以运行持久函数多长时间,所以我创建了 3 个函数
我的 DurableFunction 正在运行并在 Application Insights 中发出过去 5 天的日志,根据我的代码,它需要 15 天才能完成。
我想知道如何手动停止 Orchestrator 功能?
我可以在 ApplicationInsights 请求表中看到数千个单次执行条目,有没有办法检查后端运行了多少个 DurableFunction?以及单次执行需要多少时间?
我可以在“DurableFunctionHubInstance”表中看到一些有关协调器功能的信息,但正如 MS 建议的那样,不要依赖表。
Blazor 中有缓存清除的解决方案吗?我在 Blazor WebAssembly 中转换了我的 asp.net core 应用程序,我在 razor 页面中使用它asp-append-version=true来进行客户端缓存更新。
发现DLL 存在同样的问题
想要问一个愚蠢的问题,但我想知道答案。我不需要任何代码即可从工作线程更新UI,我知道如何从工作线程/线程池更新UI。
我想知道为什么每当任何工作线程尝试更新UI控件时,都会出现此错误“跨线程操作无效:从其他线程访问的控件”。当主线程创建的工作线程访问对象并且没有UI交互时,为什么不出现此错误?
见下面的例子
public partial class Form1 : Form
{
private void Form1_Load(object sender, EventArgs e)
{
}
TextBox textbox2 = null;
List<int> collection = new List<int>();
public Form1()
{
InitializeComponent();
textbox2 = new TextBox();
}
public void UpdateTextBox()
{
collection.Add(Thread.CurrentThread.ManagedThreadId);
textbox2.Text = "hi, ThreadId: " + Thread.CurrentThread.ManagedThreadId.ToString();
panel1.Controls.Add(textbox2);//If remove this line... will work with worker thread.
}
private void btnMainThread_Click(object sender, EventArgs e)
{
UpdateTextBox();
}
private void btnWorkerThread_Click(object sender, EventArgs e)
{
Thread t1 = new Thread(UpdateTextBox);
t1.Start();//Will …Run Code Online (Sandbox Code Playgroud) 今天,我将 Azure 功能与应用程序洞察集成以进行应用程序日志记录,特别是捕获错误堆栈跟踪。
首先,我编写了没有 try-catch 块的 Azure 函数,因此它也在“监视器”部分和应用程序洞察中显示正确的状态/信息。
后来我添加了 try-catch 块并记录了更多数据,例如
catch(Exception ex)
{
log.Error(inputData);
log.Error(ex.Message);
return req.CreateResponse(HttpStatusCode.InternalServerError);
}
Run Code Online (Sandbox Code Playgroud)
您可以在下面的附件中看到,ResultCode 是 500,状态为绿色...为什么?我认为由于这个问题,Application Insight 没有在错误/失败的请求查询中显示此数据。
在 Application Insight 中找不到记录
exceptions
|where operation_Id == "c5b5a345-fa11-4356-b769-b34d1c6619e5"
| order by timestamp desc
| project operation_Id , timestamp
Run Code Online (Sandbox Code Playgroud)
我正在尝试将我的 .netcore 网站转换为 Blazor SPA..80% 的工作已完成。我的 Facebook Like/Share 按钮没有通过 .razor 页面显示。我将 facebook javascript 放在 index.html 和 facebook "Div" 下,放在我的 .razor 页面中。
<script>
(function (d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = 'https://connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.10&appId=00000000000000';
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>
Run Code Online (Sandbox Code Playgroud)
我认为问题是 Facebook javascript 在 blazor 内容呈现在 DOM 上之前执行。有什么方法可以将组件 javascript 与该组件绑定,以便当我的 facebook 组件显示时,只有 facebook javascript 会运行?