asp.net-core-3.0

IHostBuilder does not contain a definition for ConfigureWebHostDefaults

岁酱吖の 提交于 2020-08-27 05:59:41
问题 I'm trying to use the new GenericHost in .NET Core 3.0 documented here but I'm getting a really basic error that stats IHostBuilder does not contain a definition for the ConfigureWebHostDefaults function. Looking at the ASP.NET 3.0 documentation here for the IHostBuilder interface here I cant see any reference to ConfigureWebHostDefaults so I'm a bit confused. I'm using the 3.0.0 packages for Microsoft.Extensions.Hosting and Microsoft.Extensions.Hosting.Abstractions but cant help but feel I'm

Model binding stopped working after migrating from .NET Core 2.2 to 3.0-preview-9

别等时光非礼了梦想. 提交于 2020-07-20 08:49:32
问题 I have an Angular front-end app and an ASP.NET Core back-end app. Everything was fine until I decided to migrate from ASP.NET Core 2.2 to 3.0-preview-9. For example, I have a DTO class: public class DutyRateDto { public string Code { get; set; } public string Name { get; set; } public decimal Rate { get; set; } } And an example JSON request: { "name":"F", "code":"F", "rate":"123" } Before migration, this was a valid request because 123 was parsed as a decimal. But now, after migration, I am

Model binding stopped working after migrating from .NET Core 2.2 to 3.0-preview-9

拈花ヽ惹草 提交于 2020-07-20 08:49:06
问题 I have an Angular front-end app and an ASP.NET Core back-end app. Everything was fine until I decided to migrate from ASP.NET Core 2.2 to 3.0-preview-9. For example, I have a DTO class: public class DutyRateDto { public string Code { get; set; } public string Name { get; set; } public decimal Rate { get; set; } } And an example JSON request: { "name":"F", "code":"F", "rate":"123" } Before migration, this was a valid request because 123 was parsed as a decimal. But now, after migration, I am

Adding Assemblies/Types to be made available to Razor Page at Runtime

不打扰是莪最后的温柔 提交于 2020-07-17 17:59:27
问题 I'm trying to build a dynamic Web interface where I can dynamically point at a folder and serve Web content out of that folder with ASP.NET Core. This works fairly easily by using FileProviders in ASP.NET Core to re-route the Web root folder. This works both for StaticFiles and For RazorPages. However, for RazorPages the problem is that once you do this you can't dynamically add references for additional types. I'd like to be able to optionally add a folder (PrivateBin) which on startup I can

Use latest version of Application Insight with .net core API

此生再无相见时 提交于 2020-06-17 14:42:30
问题 I have an existing API project in .net core 3.0 and also using exception middleware to log the exception. Now there is an requirement that we need to implement application insight in our API. I go through many links, but getting that some methods are already obsolete for newer version like app.UseApplicationInsightsExceptionTelemetry() and UseApplicationInsightsRequestTelemetry . Even I tried to use TelemetryClient inside the catch block of middleware, but again it is obsolete already. So

send multiple parameters to asp.net core 3 mvc action using post method

孤者浪人 提交于 2020-06-17 09:50:29
问题 There is problem in sending ajax requests that have multiple parameters to asp.net mvc core 3 action using http post method. the parameters do not bind. In dot net framework asp.net web api there was similar limitation but not in asp.net mvc actions. I want to know is there work around this in asp.net core 3 mvc or is this the new limitation? action: public string SomeAction([FromBody]string param1, [FromBody]IEnumerable<SomeType> param2, [FromBody]IEnumerable<SomeType> param3) { //param1 and

Visual studio 2019 - Publish to a folder does not publish all files

a 夏天 提交于 2020-06-16 19:13:06
问题 Using Visual Studio 2019 Community 16.3.6 I have a simple ASP.Net core 3.0 website project (mostly empty at this point), but I did add a web root folder (www) and a static index.html file within that folder, as shown below: website0 > www - index.html > Program.cs > Startup.cs When I try to publish to a folder locally (as a test), for example, I specify the destination as: D:\ws0 All of the required files are copied, EXCEPT for the "www" folder and any files within it . Hence, when I run the

Can you use IAsyncEnumerable in Razor pages to progressively display markup?

六月ゝ 毕业季﹏ 提交于 2020-06-10 16:54:50
问题 I've been playing around with Blazor and the IAsyncEnumerable feature in C# 8.0. Is it possible to use IAsyncEnumerable and await within Razor Pages to progressively display markup with data? Example service: private static readonly string[] games = new[] { "Call of Duty", "Legend of Zelda", "Super Mario 64" }; public async IAsyncEnumerable<string> GetGames() { foreach (var game in games) { await Task.Delay(1000); yield return game; } } Example in razor page: @await foreach(var game in

Can you use IAsyncEnumerable in Razor pages to progressively display markup?

社会主义新天地 提交于 2020-06-10 16:49:28
问题 I've been playing around with Blazor and the IAsyncEnumerable feature in C# 8.0. Is it possible to use IAsyncEnumerable and await within Razor Pages to progressively display markup with data? Example service: private static readonly string[] games = new[] { "Call of Duty", "Legend of Zelda", "Super Mario 64" }; public async IAsyncEnumerable<string> GetGames() { foreach (var game in games) { await Task.Delay(1000); yield return game; } } Example in razor page: @await foreach(var game in

How can I get my .NET Core 3 single file app to find the appsettings.json file?

可紊 提交于 2020-06-09 16:59:06
问题 How should a single-file .Net Core 3.0 Web API application be configured to look for the appsettings.json file that is in the same directory that the single-file application is built to? After running dotnet publish -r win-x64 -c Release /p:PublishSingleFile=true The directory looks like this: XX/XX/XXXX XX:XX PM <DIR> . XX/XX/XXXX XX:XX PM <DIR> .. XX/XX/XXXX XX:XX PM 134 appsettings.json XX/XX/XXXX XX:XX PM 92,899,983 APPNAME.exe XX/XX/XXXX XX:XX PM 541 web.config 3 File(s) 92,900,658 bytes