我有一个部署到 Azure 应用服务(基于西欧/Windows)的 Asp .NET Core 3.1 应用程序。当我使用依赖于框架的部署模式时,应用程序启动顺利。
但是,当我尝试切换到自包含部署时,应用程序无法启动并收到一条错误消息:HTTP 错误 500.30 - ANCM 进程内启动失败
将运行时从 win-x86 更改为 x64 并没有解决问题。
我检查了安装的 App Server 运行时版本,看起来运行时可用(参见下面的屏幕截图)。
我究竟做错了什么?
我有一个Foo类,其中包含很多属性,我想将所有属性迭代到一个表单中。该网站是使用 ASP.NET Core 2.2 和 Razor 构建的。
如何使用 Reflection 构建 asp-for TagHelper 似乎期望的 MemberExpression?我在论坛上读过几篇有关此问题的帖子,但没有一个答案符合我的需要。
以下代码片段不起作用。
@model Foo;
<h1>Foo Reflective filling example</h1>
@foreach(var property in typeof(Foo).GetProperties()) {
<p>
<div class="row">
<div class="col-md-3">
<label asp-for="@property.Name"></label> @*doesn't work!'*@
</div>
<div class="col-md-3">
<input asp-for="@property.Name" class="form-control" id="property.Name"/>
<span asp-validation-for="@property.Name" class="text-danger"></span>
</div>
</div>
</p>
}
Run Code Online (Sandbox Code Playgroud)
感谢您的帮助
我有两种方法连接到两个不同的Foo
s源,它们返回两个IAsyncEnumerable<Foo>
. Foo
在能够处理它们之前,我需要从两个来源获取所有s。
问题:我想同时(异步)查询两个源,即。Source1
在开始枚举之前不等待完成枚举Source2
。根据我的理解,这就是SequentialSourcesQuery
下面的方法示例中发生的情况,对吗?
对于常规任务,我只会开始第一个任务,然后是第二个,然后调用await Task.WhenAll
. 但我对如何处理有点困惑IAsyncEnumerable
。
public class FoosAsync
{
public async IAsyncEnumerable<Foo> Source1() { }
public async IAsyncEnumerable<Foo> Source2() { }
public async Task<List<Foo>> SequentialSourcesQuery()
{
List<Foo> foos = new List<Foo>();
await foreach (Foo foo1 in Source1())
{
foos.Add(foo1);
}
await foreach (Foo foo2 in Source2())
{ //doesn't start until Source1 completed the enumeration?
foos.Add(foo2);
}
return foos;
}
}
Run Code Online (Sandbox Code Playgroud)