![](/img/trans.png)
[英]How to override / substitute Error Page handling when using the Microsoft.AspNetCore.Authentication.AzureADB2C.UI?
[英]Cannot Load Microsoft.AspNetCore.Razor.Runtime after installing Microsoft.AspnetCore.Authentication.AzureADB2C.UI
我有一個簡單的 AspNet Core 3.1.1
Web 應用程序,可以正常編譯和運行。 可以說,除了自定義 HTML 和 CSS 之外,這個站點是一個使用 Visual Studio 模板創建的開箱即用的項目。
唯一添加的 nuget 包是BuildWebCompiler 1.12.394
— 不是最新的,盡管我已經嘗試更新到最新的並且不會影響接下來的問題。
如果我安裝了 nuget 包Microsoft.AspNetCore.Authentication.AzureADB2C.UI 3.1.1
一切都會繼續編譯。 但是,我在Startup.ConfigureServices
期間遇到以下異常:
System.IO.FileNotFoundException
HResult=0x80070002
Message=Could not load file or assembly 'Microsoft.AspNetCore.Razor.Runtime,
Version=3.1.1.0,
Culture=neutral,
PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.
Source=<Cannot evaluate the exception source>
StackTrace:<Cannot evaluate the exception stack trace>
除了 nuget 安裝之外,項目中沒有任何代碼或設置發生變化。 拋出異常的代碼是:
public void ConfigureServices(IServiceCollection services)
{
services.AddRazorPages(); // <--- throws
services.AddServerSideBlazor();
}
我四處探索,看到與 Core 3.1.x
幾個程序集引發了這個文件未找到異常,但沒有發現特別提到Razor.Runtime
。
Microsoft.AspNetCore.Razor.Runtime
有一個 nuget ,但它的版本是2.2.0
。 無論如何,安裝它似乎沒有幫助。
這是一個已知問題。 您可以在此處和此處跟蹤相關線程。 這是因為您更新了 NuGet 包但尚未安裝 3.1.1 運行時。
所以你可以嘗試以下兩種方法:
Microsoft.AspNetCore.Authentication.AzureADB2C.UI
降級到3.1.0
Microsoft.AspNetCore.Authentication.AzureADB2C.UI
版本3.1.1
但升級到SDK 3.1.101
參考: https : //github.com/dotnet/aspnetcore/issues/18334#issuecomment-581183460
使用Microsoft.AspNetCore.Authentication.AzureADB2C.UI 3.1.0
似乎可以解決問題。
我還沒有研究為什么。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.