asp.net-core-1.0

How do I debug an ASPNET Core MVC Application Deployed in Azure

删除回忆录丶 提交于 2019-12-05 07:12:40
I've created a simple ASPNET Core 1.0 MVC app, which I am trying to deploy to Azure using Visual Studio. I am able to run this app locally on my machine using IIS Express, and navigate to my default route and display the page. However, in Azure I always get a 500 error every time, and at this point I am at a loss for how to get additional information. I've enabled detailed request logging in my Azure app, but it doesn't really seem to tell me much. ModuleName="AspNetCoreModule", Notification="EXECUTE_REQUEST_HANDLER", HttpStatus="500", HttpReason="Internal Server Error", HttpSubStatus="0",

Glimpse diagnostics platform which is full compatible to ASP.NET Core

淺唱寂寞╮ 提交于 2019-12-05 06:58:08
I used Glimpse on the old ASP.NET MVC5 stack and liked it very much cause it gives a pretty and detailed representation of nearly all important data for debugging purpose. Sadly, its not compatible with ASP.NET Core (yet). I tried to install the demo , which assurance to work with ASP.NET Core. But thats not entirely true cause it works on ASP.NET Core, but depends on the old 4.x framework. So it destroys the cross-platform compability, which is not suiteable for me. The app is designed to run on a Linux based server using docker. Although, I would like to benefit from those nice features in

Populating Dropdown in ASP.net Core

你说的曾经没有我的故事 提交于 2019-12-05 06:30:42
Does anyone know how to deal with Dropdowns in Asp.net core. I think I made myself very complicated to understand the new Asp.net core concept. (I am new to Asp.net Core). I have models called Driver , Vehicle . Basically one can create bunch of vehicles in the master then attach it to the Driver. So that the driver will be associated with a vehicle. My problem is that I am also using viewmodel in some area to combine two different models.(understood little from default template) My problem is I have no idea what is the next step since ASP.net Core is very latest, there are not a lot of

ActionContext gone in Microsoft.AspNetCore.Mvc.Controller

江枫思渺然 提交于 2019-12-05 04:30:51
I cant find ActionContext in Microsoft.AspNetCore.Mvc.Controller after i changed my Version to AspNetCore 1.0.0-preview1 this is Controller class (after Change): And from " Microsoft.AspNet.Mvc " before change : and code from old method before update : this.Agent = ControllerInfo.Request.Headers["User-Agent"]; this.IP = ControllerInfo.HttpContext.Features.Get<IHttpConnectionFeature>()?.LocalIpAddress?.ToString(); this.RemoteIP = ControllerInfo.HttpContext.Features.Get<IHttpConnectionFeature>()?.RemoteIpAddress.ToString(); this.Refrence = ControllerInfo.ActionContext.RouteData.Values[

How to access session from a view in ASP .NET Core MVC 1.0

六月ゝ 毕业季﹏ 提交于 2019-12-05 03:48:24
I am trying to access session data from inside a view. Use Case: I'm storing status messages in the session that will be displayed at the top of the page. Currently I implemented this by using a DisplayMessages() function that sets some ViewData[....] properties and calling it at the beginning of every controller action. Goal: I want to only set the status message once without needing additional code in the controller to display the messages on the next page load. So I'm trying to access the messages that are stored in the session directly from the view. So far I have tried the following:

ASP.NET Core Response.End()?

余生颓废 提交于 2019-12-05 00:33:52
I am trying to write a piece of middleware to keep certain client routes from being processed on the server. I looked at a lot of custom middleware classes that would short-circuit the response with context.Response.End(); I do not see the End() method in intellisense. How can I terminate the response and stop executing the http pipeline? Thanks in advance! public class IgnoreClientRoutes { private readonly RequestDelegate _next; private List<string> _baseRoutes; //base routes correcpond to Index actions of MVC controllers public IgnoreClientRoutes(RequestDelegate next, List<string> baseRoutes

Read an excel file on asp.net core 1.0

老子叫甜甜 提交于 2019-12-04 23:36:05
Hello I`m trying to upload and read an excel file on my asp.net project but all the documentation I find is for ASP MVC 5. My goal is to read the excel sheet and pass the values to an list of objects. This is my controller, it works for upload the file to my wwwroot/uploads public class HomeController : Controller { private IHostingEnvironment _environment; public HomeController(IHostingEnvironment environment) { _environment = environment; } public IActionResult index() { return View(); } [HttpPost] public async Task<IActionResult> Index(ICollection<IFormFile> files) { var uploads = Path

Is there Session.Abandon() asp.net Core

≯℡__Kan透↙ 提交于 2019-12-04 23:33:14
In Asp.net WebForms there is an event called Seesion_End() in global.asax, whenever session is timeout or you call Session.Abandon() this event handler is executed, i need to have similar kind of behavior in asp.net Core, is it possible? Benader You could clear the session by simply calling: HttpContext.Session.Clear(); The docs cover most of this. The session timeout is set like this: services.AddSession(options => { options.IdleTimeout = TimeSpan.FromSeconds(10); }); But since it exists is a cookie, the cookie also has an expiration date. So if IdleTimeout expires, the session expires. If

Is there any replace of AssemblyBuilder.DefineDynamicAssembly in .NET Core?

旧街凉风 提交于 2019-12-04 22:14:09
How to port the following code to .Net Core: AppDomain.CurrentDomain.DefineDynamicAssembly( new AssemblyName( Guid.NewGuid().ToString()), AssemblyBuilderAccess.RunAndSave); Is it possible? add this to your project.json "dependencies": { "System.Reflection.Emit": "4.0.1" }, and use AssemblyBuilder.DefineDynamicAssembly(new AssemblyName(Guid.NewGuid().ToString()), AssemblyBuilderAccess.Run); AssemblyBuilderAccess.RunAndSave is not supported at the moment link to souce . Update: For new .csproj projects use: <ItemGroup> <PackageReference Include="System.Reflection.Emit" Version="4.3.0" /> <

Dependency Injection with XUnit and ASP.NET Core 1.0

南笙酒味 提交于 2019-12-04 21:40:57
问题 I am trying to figure out how I can use dependency injection with XUnit. My goal is to be able to inject my ProductRepository into my test class. Here is the code I am trying: public class DatabaseFixture : IDisposable { private readonly TestServer _server; public DatabaseFixture() { _server = new TestServer(TestServer.CreateBuilder().UseStartup<Startup>()); } public void Dispose() { // ... clean up test data from the database ... } } public class MyTests : IClassFixture<DatabaseFixture> {