.net-core

Microsoft.AspNetCore.Hosting.Abstractions manifest definition does not match the assembly reference

流过昼夜 提交于 2021-01-27 19:18:09
问题 When I run the Entitfy framework core command add-migration MyMigrationName in a class library I get the following error Could not load file or assembly 'Microsoft.AspNetCore.Hosting.Abstractions, Version=1.1.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) Funny thing there is no reference in my application to Abstractions. Here is my csproj

.Net Core Async critical section if working on same entity

你说的曾经没有我的故事 提交于 2021-01-27 17:51:29
问题 I need to be sure that a method accessed via a web API cannot be accessed by multiple call at the same time if it work on the same object with the same id I understand the use of SemaphoreSlim but a simple implemetation of that will lock the critical section for all. But I need that section locked only if it works on the same entity and not on 2 different This is my scenario, an user start to work, the entity is created and is ready to be modified, then one or more user can manipulate this

Docker and net core application doesn't work

陌路散爱 提交于 2021-01-27 17:18:32
问题 I trying setting up dotnet application with Docker. Dockerfile in "backend" folder: FROM microsoft/dotnet:1.1-sdk AS build-env WORKDIR /app COPY *.csproj ./ RUN dotnet restore COPY . ./ RUN dotnet publish -c Release -o out FROM microsoft/dotnet:1.1-runtime WORKDIR /app COPY --from=build-env /app/out ./ CMD ["dotnet", "backend.dll"] Dockerfile in "frontend" folder: # build FROM node AS build-env WORKDIR /usr/src/app COPY package.json /usr/src/app/ RUN npm install COPY . /usr/src/app/ RUN npm

Docker and net core application doesn't work

本秂侑毒 提交于 2021-01-27 16:56:28
问题 I trying setting up dotnet application with Docker. Dockerfile in "backend" folder: FROM microsoft/dotnet:1.1-sdk AS build-env WORKDIR /app COPY *.csproj ./ RUN dotnet restore COPY . ./ RUN dotnet publish -c Release -o out FROM microsoft/dotnet:1.1-runtime WORKDIR /app COPY --from=build-env /app/out ./ CMD ["dotnet", "backend.dll"] Dockerfile in "frontend" folder: # build FROM node AS build-env WORKDIR /usr/src/app COPY package.json /usr/src/app/ RUN npm install COPY . /usr/src/app/ RUN npm

Dotnet Core API - Get the URL of a controller method

雨燕双飞 提交于 2021-01-27 15:01:01
问题 I'm developing an API and it has two Controllers: PicturesController and AccountController . There's a method on PicturesController that returns an image and I'd like to know how to get its URL. On another PicturesController method, I got the URL using the code bellow: var url = Url.RouteUrl("GetPicture", new { id = picture.Id }, Request.Scheme); But I need to get the URL of the same method, however from another controller ( AccountController ). I tried the following code, but it results null

.NET Core gives unknown error while processing HTTPS certificate [closed]

|▌冷眼眸甩不掉的悲伤 提交于 2021-01-27 14:31:43
问题 Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 1 year ago . Improve this question I'm trying to build a .NET Core server that uses a HTTPS connection. I created a self-signed certificate using dotnet dev-certs tool and set up Kestrel like this: return WebHost.CreateDefaultBuilder(args) .UseKestrel(options => { options.Listen(IPAddress

Get AdministratorsMembers SIDs in .NET CORE 2

谁说我不能喝 提交于 2021-01-27 14:14:28
问题 I wrote this function to retrieve all Administrators Members SIDs: private IList<byte[]> GetAdministratorsMembersSIDs() { IList<byte[]> adminMembers = new List<byte[]>(); SecurityIdentifier id = new SecurityIdentifier(administratorsSid); string name = id.Translate(typeof(NTAccount)).Value.Split('\\')[1]; using (DirectoryEntry adminGroupEntry = new DirectoryEntry(string.Format("WinNT://./{0},group", name))) { foreach (object member in (IEnumerable)adminGroupEntry.Invoke("Members")) { using

Get AdministratorsMembers SIDs in .NET CORE 2

≡放荡痞女 提交于 2021-01-27 14:00:51
问题 I wrote this function to retrieve all Administrators Members SIDs: private IList<byte[]> GetAdministratorsMembersSIDs() { IList<byte[]> adminMembers = new List<byte[]>(); SecurityIdentifier id = new SecurityIdentifier(administratorsSid); string name = id.Translate(typeof(NTAccount)).Value.Split('\\')[1]; using (DirectoryEntry adminGroupEntry = new DirectoryEntry(string.Format("WinNT://./{0},group", name))) { foreach (object member in (IEnumerable)adminGroupEntry.Invoke("Members")) { using

DinkToPdf Net Core not able to load DLL files

爱⌒轻易说出口 提交于 2021-01-27 13:46:23
问题 I am try to generate PDF from html sql server database using DinkToPdf library. In the Startup file I have added var context = new CustomAssemblyLoadContext(); context.LoadUnmanagedLibrary(Path.Combine(Directory.GetCurrentDirectory(), "libwkhtmltox.dll")); The line gives me error on launching the web app DllNotFoundException: Unable to load DLL 'C:\Program Files\IIS Express\libwkhtmltox.dll' or one of its dependencies: The specified module could not be found. (Exception from HRESULT:

Are code contracts supported in .net core?

我只是一个虾纸丫 提交于 2021-01-27 13:11:07
问题 In the .net framework there were Code Contracts which allowed me to specify pre/post conditons in my code. Are they supported in .net core/.net 5? 回答1: Namespace System.Diagnostics.Contracts is available but project is abadoned . Alternative VS2019 https://softwarerecs.stackexchange.com/questions/47108/the-best-code-contracts-alternative-for-vs-2017-2019-and-net-core-projects Discussion about .Net Core https://github.com/dotnet/runtime/issues/23869 Is Code Contracts still the recommended way