cost 101 ms
核心 7 - Api 錯誤處理,model state 驗證 + UseExceptionhandler

[英]Core 7 - Api error handling, model state validation + UseExceptionhandler

我目前正在使用 swagger/swashbuckle in.net core 7 實現一些 Apis 並實現一些錯誤處理,我已經走上了使用異常處理程序的路線。 具有來自開發/生產的單獨端點。 例如 Startup.cs 錯誤控制器.cs 這個想法是所有響應都是 IAttempt 的,因此 FE ...

將我的 Azure Function 從 .net Core 3.1 升級到 .net Core 7.0。 錯誤“'無法加載文件或程序集'Microsoft.Extensions.Configuration.Abstraction

[英]Upgrade my Azure Function from .net Core 3.1 to .net Core 7.0. Error "'Could not load file or assembly 'Microsoft.Extensions.Configuration.Abstraction

我有一個運行在 .net 核心 3.1 上的 Azure Function,但是當我將 .net 版本從 3.1 更改為 7 時,我收到了這個錯誤:- 這是一個屏幕截圖:- 這是我的 csproj 文件:- 請問有什么建議嗎? 我已經安裝了Install-Package Microsoft.Ex ...

如何在ASP.NET Core 7.0 / VS2022中將controller端點添加到Razor服務器

[英]How to add controller endpoints to Razor Server in ASP.NET Core 7.0 / VS2022

我正在嘗試添加一個 controller 並路由到 Razor 服務器端應用程序。 我嘗試了幾件事,但我只看到 .NET 6 的解決方案,無法弄清楚。 我這樣創建了一個 controller: 然后在我的program.cs中添加: 和 AFAIK 這應該有效,端點http://localhost ...

如何使用 ASP.NET Core 7 配置 Brighter?

[英]How do you configure Brighter with ASP.NET Core 7?

如何使用 ASP.NET Core 7 配置 Brighter? Brighter 文檔在細節上相當稀疏,inte.net 上的示例似乎也已過時。 web 上是否有示例啟動代碼 (Program.cs) 和基本的 Controller? https://www.goparamore.io/ ...

如何從 _Layout.cshtml 訪問 HttpContext

[英]How do you access HttpContext from within _Layout.cshtml

項目:ASP.NET Core 7 MVC web 應用我已將 object 添加到 controller 中的HttpContext.Items集合中,我正在嘗試訪問 object 以隱藏_Layout.cshtml中的一些菜單選項,但出現錯誤 Object 需要參考如何設置參考? ...

如何創建 Net Core 中間件來驗證路由參數

[英]How to create a Net Core Middleware to validate a route parameter

使用 Net Core 7 我有 Razor 個帶有culture路由參數的頁面: 我創建了一個自定義路由約束來檢查culture是否具有有效值。 當culture值無效時,我將被重定向到 404 錯誤頁面。 如果我對有效文化進行硬編碼,這會很好用,例如: 但是如果我注入RequestLocaliz ...

如何處理 NullProviderCultureResult? 沒有重定向就渲染首頁是不是很奇怪?

[英]How to handle NullProviderCultureResult? Isn't it strange to render the homepage without redirection?

在 Net 7 項目中,我在Program中設置本地化: 我有兩個 Razor 頁面(索引和關於): 我可以使用以下方式訪問主頁(索引): 但我只能使用以下方法訪問“關於”頁面: 當我嘗試訪問“/about”時,url 沒有更改,但呈現主頁。 這不奇怪嗎? 不應該重定向到索引並更改索引 Url 嗎 ...

在 Visual Studio Community 2022 中使用 C# 在 ASP.NET Core 7 MVC 中創建報告

[英]Create Report in ASP.NET Core 7 MVC using C# in Visual Studio Community 2022

過去(很久以前)我使用 Crystal Report 來制作報告,現在我正在使用 Visual Studio 2022。我正在嘗試為 ASP.NET Core 7 MVC 制作報告,我從 Marketplace 找到並安裝了 Microsoft RDLC Report Designer 並提供我有機 ...

我怎樣才能改變 ASP.NET Core 7.0 的這個問題?

[英]How can I change this problem for ASP.NET Core 7.0?

這個項目是在.NET 4.6上為ASP.NET創建的,但現在我會嘗試將它移動到ASP.NET Core 7.0。 在 ASP.NET Core 7 中,我可以寫什么來代替這段代碼? 舊的LoginController : 它創建了一個新的 cookie,所以對我沒有幫助 ...

如何在 Entity Framework Core 中使用通用存儲庫和工作單元模式時獲取外鍵鏈接值

[英]How to get foreign key linked values while using generic repository and unit of work patterns with Entity Framework Core

我是 Entity Framework Core 7 和 ASP.NET Core 7 MVC 的新手。 我正在使用 Northwind 數據庫學習這些概念。 我在 EF Core 之上使用通用存儲庫和 UnitOfWork 模式進行數據訪問。 我創建了一個ProductsController並在視 ...

ASP.NET Core 7 與 CustomWebApplicationFactory 的集成測試<tprogram>客戶端總是返回 404 not found</tprogram>

[英]ASP.NET Core 7 Integration Test with CustomWebApplicationFactory<TProgram> Client always returns 404 not found

我的asp.net core 7 web api應用程序正在使用Program.cs和Startup.cs運行。 我已經使用CustomWebApplicationFactory&lt;TStartup&gt;編寫了我的Integration Tests 。 一切都按預期工作。 現在我決定離開St ...

我遇到了 MySQL 和 MariaDB 的暫時性故障

[英]I'm getting a transient failure with MySQL and MariaDB

我正在研究一個簡單的 Web API,它使用 MySQL 作為數據庫。 這是非常基本的: 這個想法很簡單。 這是一個中間件方法,它根據響應中的狀態代碼將所有請求寫入數據庫,無論是“有效”還是“無效”。 這個 API 可能每小時收到大約 10 個請求,所以它應該可以工作。 除了它不... 如果有的話, ...

手動設置表單的操作,不會自動注入防偽

[英]Setting a form's action manually, no Antiforgery is auto-injected

當我手動設置action屬性時,“Antiforgery”元素/令牌丟失(不是自動生成/注入的) 部分視圖中的代碼(部分) 渲染代碼(客戶端) 但是當我省略action時,它會被創建(在客戶端中呈現代碼)。 這是默認行為嗎,如果想手動設置action ,還需要手動添加“防偽”元素嗎? 一張紙條如果使 ...


 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM