asp.net-core-1.0

Publishing a dotnet application that's already running

a 夏天 提交于 2021-02-18 06:26:42
问题 I'm attempting to create a script to simplify the process of publishing a .NET Core website. I'm running into an issue when I run dotnet publish against an already running server. The server is IIS with the dotnet bundle installed, so IIS uses its app pool to start dotnet. Here's my batch file. I'm happy to use another script type: cd src/app dotnet build --no-incremental dotnet publish --framework netcoreapp1.0 --configuration Release --output ../../dist When I run the script I get this

Publishing a dotnet application that's already running

扶醉桌前 提交于 2021-02-18 06:26:17
问题 I'm attempting to create a script to simplify the process of publishing a .NET Core website. I'm running into an issue when I run dotnet publish against an already running server. The server is IIS with the dotnet bundle installed, so IIS uses its app pool to start dotnet. Here's my batch file. I'm happy to use another script type: cd src/app dotnet build --no-incremental dotnet publish --framework netcoreapp1.0 --configuration Release --output ../../dist When I run the script I get this

Handle Exceptions from inside Hangfire

最后都变了- 提交于 2020-12-13 05:03:51
问题 I have a scenario, I am scheduling a BackgroundJob to run after some random seconds on application start. After the job is performed then I am again scheduling the same BackgroundJob to run after some random seconds and it goes on and never stops. What I want is if any exception occurs in Hangfire during this continuous process I want to shut-down my asp.net core app. for example, while this process is happening I stop the SQL Server. So hangfire giving this exception that is obvious System

How to render action of specific controller in master Layout view in .NET Core?

浪子不回头ぞ 提交于 2020-05-13 13:37:08
问题 I am calling "TopNav" partial from within Layout master view. I want TopNav view to be strongly typed and the model to be created within TopNavController . Is there any way to render the action of a specific controller from within the master view? So in this case I need to render TopNav action of TopNavController in the Layout . So far I can only use eg. @Html.Partial("TopNav") or @Html.RenderPartial("TopNav") with option to pass the model but I need to instantiate the model within the

Change default format for DateTime parsing in ASP.NET Core

此生再无相见时 提交于 2020-04-05 08:41:23
问题 I get a Date in an ASP.NET Core Controller like this: public class MyController:Controller{ public IActionResult Test(DateTime date) { } } The framework is able to parse the date, but only in English format. When I pass 04.12.2017 as date parameter, I mean the 4th of december 2017. This would get parsed as english date, so my date object gets the value 12th of April 2017. I tried adding german only using this article and also this, but without success. What needs to be done that ASP.NET Core

Change default format for DateTime parsing in ASP.NET Core

两盒软妹~` 提交于 2020-04-05 08:41:18
问题 I get a Date in an ASP.NET Core Controller like this: public class MyController:Controller{ public IActionResult Test(DateTime date) { } } The framework is able to parse the date, but only in English format. When I pass 04.12.2017 as date parameter, I mean the 4th of december 2017. This would get parsed as english date, so my date object gets the value 12th of April 2017. I tried adding german only using this article and also this, but without success. What needs to be done that ASP.NET Core

DataAnnotationsModelValidatorProvider.RegisterAdapter in ASP.Net Core MVC

五迷三道 提交于 2020-02-20 05:24:05
问题 In ASP.Net MVC 5, custom data annotation validator can be implemented by inheriting DataAnnotationsModelValidator and registering using DataAnnotationsModelValidatorProvider.RegisterAdapter(...) . In ASP.Net Core MVC, how can I achieve this? I found similar question at ASP.net core MVC 6 Data Annotations separation of concerns, but can anyone show me simple example code? 回答1: It seems to me ASP.NET Core MVC does not have support for DataAnnotationsModelValidatorProvider.RegisterAdapter

HTTP 502.5 error after updating ASP.NET Core 1.0 to 1.1

南笙酒味 提交于 2020-01-24 02:47:07
问题 Steps to reproduce I used this official ASP.NET and this articles to upgrade my ASP.NET Core 1.0 app to 1.1. The app compiles fine but when I run the app using F5, I get the following error Error : HTTP Error 502.5 - Process Failure Common causes of this issue: The application process failed to start The application process started but then stopped The application process started but failed to listen on the configured port Further technical details Operating system: Windows 10 Visual Studio

How do I implement custom model validation in ASP.NET Core?

孤人 提交于 2020-01-24 02:00:07
问题 In previous versions of ASP.NET MVC the way to add custom validation to your model was by implementing the IValidatableObject and implementing your own Validate() method. As an example: public class BestModelEver : IValidatableObject { public DateTime? Birthday { get; set; } public IEnumerable<ValidationResult> Validate(ValidationContext validationContext) { if (Birthday.HasValue) { yield return new ValidationResult("Error message goes here"); } } } Is this still the recommended way of adding