我有使用 mongodb 作为后端的 asp.net 核心应用程序。
最近,我开始收到此错误,而数据库或代码没有任何更改。
这是我浏览 API 时遇到的完整错误
An error occurred while starting the application.
InvalidOperationException: Record reader index out of sync.
DnsClient.DnsRecordFactory.GetRecord(ResourceRecordInfo info)
DnsResponseException: Unhandled exception
DnsClient.LookupClient.ResolveQuery(DnsMessageHandler handler, DnsRequestMessage request, Audit continueAudit)
InvalidOperationException: Record reader index out of sync.
DnsClient.DnsRecordFactory.GetRecord(ResourceRecordInfo info)
DnsClient.DnsMessageHandler.GetResponseMessage(ArraySegment<byte> responseData)
DnsClient.DnsUdpMessageHandler.Query(IPEndPoint server, DnsRequestMessage request, TimeSpan timeout)
DnsClient.LookupClient.ResolveQuery(DnsMessageHandler handler, DnsRequestMessage request, Audit continueAudit)
Show raw exception details
DnsResponseException: Unhandled exception
DnsClient.LookupClient.ResolveQuery(DnsMessageHandler handler, DnsRequestMessage request, Audit continueAudit)
DnsClient.LookupClient.Query(DnsQuestion question)
MongoDB.Driver.Core.Configuration.ConnectionString.Resolve()
MongoDB.Driver.MongoUrl.Resolve()
MongoDB.Driver.MongoClientSettings.FromUrl(MongoUrl url)
MongoDbGenericRepository.MongoDbContext..ctor(string connectionString, string databaseName) …Run Code Online (Sandbox Code Playgroud) 我在blazor中有简单的形式,如下所示。
<EditForm Model="@createInvoice" OnValidSubmit="@CreateInvoice" >
<DataAnnotationsValidator></DataAnnotationsValidator>
<p>
<label for="ddlService">Service</label>
<InputSelect id="ddlService" @bind-Value="@createInvoice.SelectedService">
<option value="0">Select Service</option>
@foreach (var item in Services)
{
<option value="@item.ServiceId">@item.Name</option>
}
</InputSelect>
<ValidationMessage For="@(()=> createInvoice.SelectedService)"></ValidationMessage>
</p>
</EditForm>
Run Code Online (Sandbox Code Playgroud)
我正在尝试使用数据注释属性来验证表单。使用editform的OnSubmit提交表单,但在提交之前未触发验证。如果我使用OnValidSubmit,它将触发验证。
有人可以解释OnSumbit,OnValidSubmit和OnInvalidSubmit如何工作。