.net-core

Image format Unknown

白昼怎懂夜的黑 提交于 2021-02-08 04:13:04
问题 I am trying to read an image into Base64 format using .Net Core 2.2 and it throws ArgumentException: Image format is unknown. System.Drawing.Image.FromFile(string filename, bool useEmbeddedColorManagement) The filePath is correct, and I have double and triple checked that the file exists. I have attempted naming my PNGs with both upper and lowercase extension. This does not happen locally on windows, but once the application is deployed to linux is happens. The code in question is below.

Image format Unknown

▼魔方 西西 提交于 2021-02-08 04:11:32
问题 I am trying to read an image into Base64 format using .Net Core 2.2 and it throws ArgumentException: Image format is unknown. System.Drawing.Image.FromFile(string filename, bool useEmbeddedColorManagement) The filePath is correct, and I have double and triple checked that the file exists. I have attempted naming my PNGs with both upper and lowercase extension. This does not happen locally on windows, but once the application is deployed to linux is happens. The code in question is below.

How to shutdown computer from a .NET Core application running on Linux

杀马特。学长 韩版系。学妹 提交于 2021-02-08 04:01:34
问题 I have a .net core 2.0 program running on Linux (Ubuntu Server 16.04 LTS). I'm trying to shutdown the computer by invoking a process with the following command: sudo shutdown -h now , though when the program is running in the background as daemon service, the shutdown process does not work. Here is the code: var process = new Process { StartInfo = { CreateNoWindow = true, RedirectStandardError = true, RedirectStandardInput = true, RedirectStandardOutput = true, UseShellExecute = false,

How to shutdown computer from a .NET Core application running on Linux

旧城冷巷雨未停 提交于 2021-02-08 04:01:32
问题 I have a .net core 2.0 program running on Linux (Ubuntu Server 16.04 LTS). I'm trying to shutdown the computer by invoking a process with the following command: sudo shutdown -h now , though when the program is running in the background as daemon service, the shutdown process does not work. Here is the code: var process = new Process { StartInfo = { CreateNoWindow = true, RedirectStandardError = true, RedirectStandardInput = true, RedirectStandardOutput = true, UseShellExecute = false,

Connect multiple Databases to .NET core project via Entity Framework Core

梦想与她 提交于 2021-02-08 03:36:25
问题 I am trying to create a .NET core application that connects to multiple databases, but using one generic repository that contains the logic for all CRUD operations. What is the best way to achieve this? public Repository(ApplicationDbContext dbContext) { _dbContext = dbContext; _set = _dbContext.Set<T>(); } Above is the constructor of my repository. Here, I inject the ApplicationDbContext. I am looking for a way to make this ApplicationDbContext generic, so I only have to need only one

Page LDAP query against AD in .NET Core using Novell LDAP

坚强是说给别人听的谎言 提交于 2021-02-07 23:46:31
问题 I am using the Novell LDAP library for making queries to an Active Directory from a .NET Code application. Most of the queries succeed, but some return more than 1000 results, which the AD server refuses. I therefore tried to find out how to page LDAP queries using Novell's library. The solution I put together looks like public IEnumerable<LdapUser> GetUsers() { this.Connect(); try { var cntRead = 0; // Total users read. int? cntTotal = null; // Users available. var curPage = 0; // Current

Page LDAP query against AD in .NET Core using Novell LDAP

删除回忆录丶 提交于 2021-02-07 23:45:47
问题 I am using the Novell LDAP library for making queries to an Active Directory from a .NET Code application. Most of the queries succeed, but some return more than 1000 results, which the AD server refuses. I therefore tried to find out how to page LDAP queries using Novell's library. The solution I put together looks like public IEnumerable<LdapUser> GetUsers() { this.Connect(); try { var cntRead = 0; // Total users read. int? cntTotal = null; // Users available. var curPage = 0; // Current

Log UserName and IP with Custom Properties in Application Insight .Net Core 2.1

断了今生、忘了曾经 提交于 2021-02-07 23:02:51
问题 We are running an intranet Application on .Net Core 2.0. Application insight is very helpfull to catch exceptions. So when the User comes up to us for support we would like to find his request that caused problems in application insight. I added an ClientIpHeaderTelemetryInitializer like this: public class CustomTelemetry : ClientIpHeaderTelemetryInitializer { private readonly IHttpContextAccessor _httpContextAccessor ; public CustomTelemetry(IHttpContextAccessor httpContextAccessor) : base

How to get FFProbe to run using dotnet core as an Azure Function in Docker?

送分小仙女□ 提交于 2021-02-07 21:14:05
问题 I am trying to get video details (length, height, width, and content type) from a video based on a URL. By using the nuget package https://www.nuget.org/packages/NReco.VideoInfo.LT I was able to create an Azure Function running locally pointing to my local install of FFProbe rather easily. However, the trick is now making it compatible with an Azure Function and, to the best of my knowledge, the easiest way to do that is by providing a Docker image that contains everything needed (this would

How to get FFProbe to run using dotnet core as an Azure Function in Docker?

萝らか妹 提交于 2021-02-07 21:02:12
问题 I am trying to get video details (length, height, width, and content type) from a video based on a URL. By using the nuget package https://www.nuget.org/packages/NReco.VideoInfo.LT I was able to create an Azure Function running locally pointing to my local install of FFProbe rather easily. However, the trick is now making it compatible with an Azure Function and, to the best of my knowledge, the easiest way to do that is by providing a Docker image that contains everything needed (this would