dnx

Write to EventLog in .Net Core

冷暖自知 提交于 2019-12-01 00:02:48
问题 I need a way to write to Windows' event viewer in my app that's using dnx. But, the EventLog class isn't available in the System.Diagnostics namespace so I'm stuck. Is there any other way to write to the EventViewer? 回答1: Add from NuGet Microsoft.Extensions.Logging.EventLog Version 2.1.1 CM> Install-Package Microsoft.Extensions.Logging.EventLog -Version 2.1.1 Include the namespace Microsoft.Extensions.Logging.EventLog in the Program.cs file This resolved my problem. 回答2: Good news! EventLog

ServicePointManager.DefaultConnectionLimit in .net core?

妖精的绣舞 提交于 2019-11-30 15:18:43
问题 I am porting a web api 2 service to .net core and I found this line in my old web api service. ServicePointManager.DefaultConnectionLimit = int.MaxValue; This line of code increases the connection limit. I don't know if it's for the computer or the framework or just the application. And after reading this answer on stackoverflow, I also realise that setting it to int.max may not be the best idea. However I would still like to have control over it in my new .net core service. How do I modify

What are my options for sharing code between DNX / ASP.NET 5 projects (project.json / xproj) and other C# projects (csproj) within a single solution?

删除回忆录丶 提交于 2019-11-30 10:46:53
问题 Scenario I'm experimenting with Visual Studio 2015 RC, specifically looking at switching to the new ASP.NET 5 framework, project structure and the new DNX that runs ASP.NET 5 applications. My employer has many existing solutions targeting .NET Framework 4.5.2. In our existing Visual Studio solutions we might have the following projects: [Solution] Sample.sln [Folder] src [Project] ClassLibrary.csproj [Project] WindowsService.csproj [Project] WebApplication.csproj [Folder] test [Project]

Unable to resolve assembly reference issue without frameworkAssemblies

吃可爱长大的小学妹 提交于 2019-11-30 02:38:08
I'm trying to validate that Protocol Buffers is going to work with the new portable runtimes from the ASP.NET team and ideally most other modern environments. The 3.0.0-alpha4 build was created a while ago using profile259, so I would expect some changes to be required in some cases, but I thought I'd give it a try. I'm aware of Oren Novotny's post about targeting .NET Core , and expected to have to make some changes to the Google.Protobuf nuspec file , but the error I'm running into has me stumped. DNX version: 1.0.0-rc1-update1 The scenario I'm currently trying to test is a console app

How to stream a video or a file considering request and response range headers?

偶尔善良 提交于 2019-11-29 23:15:02
I am now using FileStreamResult and it works to stream a video, but can't seek it. It always starts again from the beginning. I was using ByteRangeStreamContent but it seems that it is not available anymore with dnxcore50 . So how to proceed ? Do i need to manually parse the request range headers and write a custom FileResult that sets the response Content-Range and the rest of the headers and writes the buffer range to the response body or is there something already implemented and i'm missing it ? Here is a naive implementation of a VideoStreamResult , i'm using at the moment (the multipart

How to setup a TeamCity build for a ASP.NET 5 project

家住魔仙堡 提交于 2019-11-29 23:14:50
I'm trying to setup a CI server for a website that I'm developing, but I can't find any info regarding how to do it with the new ASP.NET 5. We (the ASP.NET team) use TeamCity as the build server. Each repo has a build.cmd file, similar to this one . TeamCity simply invokes that file. For Mac/Linux builds, there is a build.sh file. I got you brother. This took me a few days to figure out. This configuration is on TeamCity v10 for a ASP.NET Core 1.0 RC2/preview2 project. As a bonus, I am including the step where it pushes to Octopus Deploy. You will need to install the dotnet teamcity plugin and

Alternative solution to HostingEnvironment.QueueBackgroundWorkItem in .NET Core

六眼飞鱼酱① 提交于 2019-11-29 22:52:17
We are working with .NET Core Web Api, and looking for a lightweight solution to log requests with variable intensity into database, but don't want client's to wait for the saving process. Unfortunately there's no HostingEnvironment.QueueBackgroundWorkItem(..) implemented in dnx , and Task.Run(..) is not safe. Is there any elegant solution? Axel Heer QueueBackgroundWorkItem is gone, but we've got IApplicationLifetime instead of IRegisteredObject , which is being used by the former one. And it looks quite promising for such scenarios, I think. The idea (and I'm still not quite sure, if it's a

What are my options for sharing code between DNX / ASP.NET 5 projects (project.json / xproj) and other C# projects (csproj) within a single solution?

你离开我真会死。 提交于 2019-11-29 22:07:08
Scenario I'm experimenting with Visual Studio 2015 RC, specifically looking at switching to the new ASP.NET 5 framework, project structure and the new DNX that runs ASP.NET 5 applications. My employer has many existing solutions targeting .NET Framework 4.5.2. In our existing Visual Studio solutions we might have the following projects: [Solution] Sample.sln [Folder] src [Project] ClassLibrary.csproj [Project] WindowsService.csproj [Project] WebApplication.csproj [Folder] test [Project] ClassLibrary.UnitTests.csproj ... In this scenario, ClassLibrary.csproj is a C# class library containing

How to reference an ASP.NET 5 project from another project?

风流意气都作罢 提交于 2019-11-29 14:46:35
I have a Web Application project created from ASP.NET 5 Preview Templates in VS2015. It is running on dnx 1.0.0-beta7, but I'm using full .NET framework rather than .NET Core. Within the same solution I have a NUnit class library project, but when trying to add the web project as a reference here, Visual Studio says "A reference to '...' could not be added." Is there a workaround for this? Or what is the preferred way of unit testing ASP.NET vNext applications? The easiest way is to make sure that your ASP.NET 5 web project and the test project share a common parent directory . For example:

How to reference Windows.winmd from a .NET Core library?

ぐ巨炮叔叔 提交于 2019-11-29 12:53:56
I'm looking to use Windows Runtime types, like Frame or Button , from a .NET Core library. It seemed to be working fine when I was using a traditional PCL, targeted for Windows/Windows Phone 8.1. For some reason, however, it's not compiling after I switched my project to DNX. Here's my project.json : { "frameworks": { // Profile32 == Windows + Windows Phone 8.1 ".NETPortable,Version=v4.6,Profile=Profile32": { } } } And here is my sample code: using System.Linq; using Windows.UI.Xaml.Controls; public class Sample { public void Method() { Enumerable.Empty<Frame>(); } } I was getting a compiler