asp.net-core-1.0

How to use PCL in ASP.NET Core 1.0 RC2 project

时光毁灭记忆、已成空白 提交于 2019-12-20 01:41:47
问题 I want to use a simple (POCO only without other dependencies) PCL with targets Xamarin.Android Universal Windows 10 ASP.NET Core 1.0 in an ASP.NET Core 1.0 RC2 project (all in the same solution). I have added this import to my project.json: "frameworks": { "netcoreapp1.0": { "imports": [ "dotnet5.6", "dnxcore50", "portable-net451+win8" ], "dependencies": { "PCL.Library": { "target": "project" } } } } I don’t get any errors (compilation or otherwise) and the PCL.Library project shows up in the

asp.net mvc core The call is ambiguous between the following methods or properties:

狂风中的少年 提交于 2019-12-20 01:17:11
问题 I am working on an application, and I got an error in Startup.cs partial classes, and I cant find why this error shows up: The call is ambiguous between the following methods or properties: Microsoft.Extensions.DependencyInjection.OptionsServiceCollectionExtensions.Configure(Microsoft.Extensions.DependencyInjection.IServiceCollection, System.Action) Microsoft.Extensions.DependencyInjection.OptionsServiceCollectionExtensions.Configure(Microsoft.Extensions.DependencyInjection.IServiceCollection

ASP.NET Core DisplayAttribute Localization

被刻印的时光 ゝ 提交于 2019-12-19 16:28:26
问题 According to the documentation: The runtime doesn’t look up localized strings for non-validation attributes. In the code above, “Email” (from [Display(Name = "Email")]) will not be localized. I'm looking for a way to localize text in DisplayAttribute. Any suggestions to do it in a proper way(s)? 回答1: You can set the ResourceType on the DisplayAttribute which can be used to localize your text. Add a resource .resx file to your project e.g. MyResources.resx , and add a resource for your field:

Basic Authentication in ASP.NET Core

僤鯓⒐⒋嵵緔 提交于 2019-12-18 13:53:11
问题 Question How can I implement Basic Authentication with Custom Membership in an ASP.NET Core web application? Notes In MVC 5 I was using the instructions in this article which requires adding a module in the WebConfig . I am still deploying my new MVC Core application on IIS but this approach seems not working. I also do not want to use the IIS built in support for Basic authentication , since it uses the Windows credentials. 回答1: ASP.NET Security will not include Basic Authentication

ASP.NET Core Configuration Section in Startup

↘锁芯ラ 提交于 2019-12-18 13:52:24
问题 I am migrating a ASP.NET 5 RC1 project to ASP.NET Core, and have come across an interesting issue I've not yet seen, or found a solution for. In order to use configuration settings within Startup I have previously retrived the configuration the following way // Works fine for DI both in ASP.NET 5 RC1 and ASP.NET Core services.Configure<SomeConfigurationClass>(Configuration.GetSection("SomeConfigurationSection")); // How I previous retrieved the configuration for use in startup. // No longer

How to set aspnetcore_environment in publish file?

痴心易碎 提交于 2019-12-18 11:42:03
问题 I have ASP.NET Core application (Web Api). The documentation has explained working with multiple environments, however it failed to explain how to set aspnetcore_environment when publishing the web site. So lets say if i have 3 environments Development , Staging and Production In classic ASP.NET Web Application i used to create 3 build configurations. Development , Staging and Production ( Like shown in picture below). and then 3 .pubxml files, one for each configuration. Do i need to use the

How to validate XML in .NET Core 1.1.2

与世无争的帅哥 提交于 2019-12-18 09:46:43
问题 How can i validate XML against XSD schema in .NET Core 1.1.2? i found this ms docs but i cannot use it with .NET core 1.1.2 using System; using System.Collections.Generic; using System.Text; using System.Xml; using System.Xml.Schema; namespace MyNameSpace { public static class XmlValidation { public static void Validate(string schema, string xml) { XmlReaderSettings schemaSettings = new XmlReaderSettings(); schemaSettings.Schemas.Add(schema); schemaSettings.ValidationType = ValidationType

Referencing standard dlls from a .NET Core XUnit project

人走茶凉 提交于 2019-12-18 07:03:47
问题 I am using the latest version of XUnit and I followed these steps to get the Class Library (.NET Core) project started. All other libraries throughout my entire solution are only using 4.6.1 so I changed the frameworks section in project.json to the following: { "frameworks": { "net461": { "dependencies": { "Microsoft.NETCore.Platforms": "1.0.1-rc2-24027" } } } } and everything works fine inside of my solution. I am able to run tests and all references to other libraries work fine even though

Failed to make the following project runnable (Object reference not set to an instance of an object.)

纵然是瞬间 提交于 2019-12-18 05:44:43
问题 When I create default web project in Visual Studio 2015 (Update 3) with installed .NET Core 1.0 SDK and Tooling (preview 2) and restart the Visual Studio after reverting local source control changes I am getting the following compilation error : Failed to make the following project runnable: MyDefaultWebProject (.NETCoreApp,Version=v1.0) reason: Object reference not set to an instance of an object. According to Visual Studio the error is located in C:\Program Files (x86)\MSBuild\Microsoft

Value cannot be null. Parameter name: connectionString appsettings.json in starter

拟墨画扇 提交于 2019-12-18 05:37:45
问题 I am trying to write my connection string in my appsettings.json file and bring it into my startup file but I keep getting a Value cannot be null. Parameter name: connectionString. I have been using various examples but can't seem to see this new setup with ASP.NET 1.0 Core startup class. Appsetting.json file: { "Data": { "DefaultConnection": { "ConnectionString": "Data Source=server;Initial Catalog=dbase;Trusted_Connection=True;MultipleActiveResultSets=true" }, "Logging": { "IncludeScopes":