asp.net-core-mvc

How to resolve this?, are you missing assembly reference

纵饮孤独 提交于 2020-01-07 08:03:33
问题 The namespace client does not exist in Microsoft.teamfoundation are you missing assembly reference I have added Nuget packages Microsoft.TeamFoundationServer.Client and Microsoft.TeamFoundationServer.ExtendedClient but I'm still facing this issue. I want to extract work item details from the TFS. 回答1: Microsoft.TeamFoundationServer.Client provides access to version control, work item tracking, build, and more via public REST APIs. Microsoft.TeamFoundationServer.ExtendedClient works with and

Angular2 routing - url doesn't change and page doesn't load

佐手、 提交于 2020-01-07 04:59:08
问题 I've started learning angular2 with typescript and I'm trying to implement a route of book/:id but my route doesn't change and the html doesn't neither. I have this file called app.module.ts which has all my other routes which work: app.module.ts import { NgModule } from '@angular/core'; import { RouterModule } from '@angular/router'; import { UniversalModule } from 'angular2-universal'; import { AppComponent } from './components/app/app.component' import { NavMenuComponent } from '.

ASP.NET Core precompiled views on publish

旧街凉风 提交于 2020-01-07 04:19:11
问题 I've previously created an ASP.NET Core project with .NET Core 2.0 preview 1 and Visual Studio 2017 15.3 preview. Just the default stuff from the project template, no custom code yet. Then I used the Publish command and have everything copied to the directory bin\Release\PublishOutput. All nice and good. 5 MB, can be deployed to the production web server and it works. Now I've tried the same thing with VS Code and just won't get anywhere. I created the project with dotnet new mvc and opened

after adding @addTagHelper to the *.cshtml file. error 500 is shown

对着背影说爱祢 提交于 2020-01-06 20:19:35
问题 When I Use @addTagHelper "*, Microsoft.AspNet.Mvc.TagHelpers" in My .cshtml file it causes error 500. but it's work in another ViewComponent 回答1: which version? please give us more information. if you are using rc1-update1 use @addTagHelper *, Microsoft.AspNet.Mvc.TagHelpers 回答2: I had the same problem and couldn't figure out the exact cause. However, changing the "Microsoft.AspNet.Mvc.TagHelpers" depencency in my json file from "6.0.0-betaX" to "6.0.0-rc1-final" fixed the issue. Make sure to

ASP.NET 5 MVC 6 Issues hosting application in IIS 8

◇◆丶佛笑我妖孽 提交于 2020-01-06 20:09:57
问题 I published ASP.NET 5 MVC 6 application in file system from Visual studio 2015 and then I copied over that code to IIS server and configured accordingly as per this link. I created a website and pointed it to wwwroot folder as per instructions in above link. When I browse the site, I get 404 in IE browser. So what I did is I turned on logging in web.config file which is under wwwroot folder. I set the value of stdoutLogEnabled to true stdoutLogEnabled="true" . And then I tried to browse the

How to Determine Session ID when using SQL Sever session storage

六眼飞鱼酱① 提交于 2020-01-06 15:19:06
问题 I followed this guide to set up Sql Server as my store for Session data. I noticed the Sessions table has an ID column. I was hoping I could use this ID column to determine the current session (row in the Sessions table) being used. However, I don't know how this ID is generated or how ASP.NET Core behind the scenes matches this ID to the Session. I tried using HttpContext.Session.Id , but it is different from the ID in the database. So, how do I determine which row is being used for the

Suppression State Error CS0266 When Selecting Data From Database Using LINQ

大城市里の小女人 提交于 2020-01-06 05:50:30
问题 I have an Index view that shows a list of tenants and it works great. I added a small form to the index view to take in and pass a query string to the index method of my Tenants controller. As you can see, I have an If statement that checks to see if the query string is empty. If it is not empty, it goes in and grabs a tenant that has a first name that contains characters of the query string. Well, it is at this point I am receiving an error. I believe it has something to do with the way I am

ASP.NET Core 2.2 MVC : wrap responses

偶尔善良 提交于 2020-01-06 05:35:06
问题 I have an application developed in ASP.NET Core MVC with a set of controllers for normal view responses and Web API. I am trying to figure a correct way to wrap all Web API responses with a consistent class. My first question is what would be a correct approach to wrap the responses coming from Web API controllers. Since I have two controller types, I would need to distinguish between them as the responses should only be wrapped for API controller, and not view controllers. As I understand

Does ASP.NET Core Support JSON Web Signatures for RESTful Web APIs?

谁都会走 提交于 2020-01-06 04:08:06
问题 I have read some excellent tutorials on using JSON Web Tokens with ASP.NET Core to authenticate requests to a REST API, however I can find no documentation on whether the more general JSON Web Signature (rfc7515) is supported for use with REST API Definitions to tamper-protect the contents of requests. For example, the following Controller allows a simple POST request whereby a JSON serialized 'CreateRequest' object is submitted to the API and handled: [Produces("application/json")] [Route(

How to create custom Routing in ASP.NET Core

空扰寡人 提交于 2020-01-06 02:33:26
问题 I need help with URL rewriting. I am new to ASP.NET Core MVC. When I type anything in {param} part then routing should redirect it to my controller. So if anyone to types in {param} like https://mydoamin.com/{param} then it should be redirected to this url: https://mydoamin.com/{controller}/{action}/{actionurl}={param} 回答1: I found the answer for my question. Just define new custom route in your startup.cs file before your default route. routes.MapRoute( "Member", // Route name "{actionURL}",