Hot Reload for ASP.NET Core
dotnet watch
dotnet run
dotnet build
dotnet watch build
References
https://docs.microsoft.com/en-us/aspnet/core/test/hot-reload
https://docs.microsoft.com/en-us/aspnet/core/tutorials/dotnet-watch
dotnet watch
dotnet run
dotnet build
dotnet watch build
References
https://docs.microsoft.com/en-us/aspnet/core/test/hot-reload
https://docs.microsoft.com/en-us/aspnet/core/tutorials/dotnet-watch
This error message often happens when you use areas and you have the same controller name inside the area and the root. For example you have the two:
~/Controllers/HomeController.cs ~/Areas/Admin/Controllers/HomeController.cs
In order to resolve this issue (as the error message suggests you), you could use namespaces when declaring your routes. So in the main route definition in Global.asax:
routes.MapRoute( "Default", "{controller}/{action}/{id}", new { controller = "Home", action = "Index", id = UrlParameter.Optional }, new[] { "AppName.Controllers" } );
and in your ~/Areas/Admin/AdminAreaRegistration.cs:
context.MapRoute( "Admin_default", "Admin/{controller}/{action}/{id}", new { action = "Index", id = UrlParameter.Optional }, new[] { "AppName.Areas.Admin.Controllers" } );
If you are not using areas it seems that your both applications are hosted inside the same ASP.NET application and conflicts occur because you have the same controllers defined in different namespaces. You will have to configure IIS to host those two as separate ASP.NET applications if you want to avoid such kind of conflicts. Ask your hosting provider for this if you don’t have access to the server.
References :
http://stackoverflow.com/questions/7842293/multiple-types-were-found-that-match-the-controller-named-home
Web.config’s appSettings:
<appSettings> <add key="owin:AutomaticAppStartup" value="false" /> </appSettings>
References :
http://tom-jaeschke.blogspot.co.za/2015/11/to-disable-owin-startup-discovery-add.html
Keywords :
exception , signalr
public JsonResult GetCategories() { nDownloadEntities entities = new nDownloadEntities(); List<Category> categories = entities.Categories.ToList(); var sb = new StringBuilder(); var roots = GetRoots(categories); string unorderedList = GenerateUL(roots, categories, sb); return Json(unorderedList, JsonRequestBehavior.AllowGet); } [NonAction] private List<Category> GetRoots(List<Category> categories) { var roots = categories.Where(x => x.ParentId == 0).ToList(); return roots; } [NonAction] private string GenerateUL(List<Category> parents, List<Category> categories, StringBuilder sb) { sb.AppendLine("<ul>"); if (parents.Count > 0) { foreach (Category category in parents) { string line = String.Format(@"<li>{0}", category.CategoryText); sb.Append(line); List<Category> subMenu=categories.Where(x=>x.ParentId==category.CategoryId).ToList(); if (subMenu.Any()) { var subMenuBuilder = new StringBuilder(); sb.Append(GenerateUL(subMenu, categories, subMenuBuilder)); } sb.Append("</li>"); } } sb.Append("</ul>"); return sb.ToString(); }
Keywords :
ul , li , treeview , menu , recursive
JavaScript :
BundleConfig.RegisterBundles(BundleTable.Bundles);
bundles.Add(new ScriptBundle("~/bundles/jqueryui").Include( "~/Scripts/jquery-ui-{version}.js"));
@Scripts.Render("~/bundles/jqueryui")
CSS :
bundles.Add(new StyleBundle("~/Content/themes/base/css").Include( "~/Content/themes/base/jquery.ui.core.css", "~/Content/themes/base/jquery.ui.resizable.css", "~/Content/themes/base/jquery.ui.selectable.css", "~/Content/themes/base/jquery.ui.accordion.css", "~/Content/themes/base/jquery.ui.autocomplete.css", "~/Content/themes/base/jquery.ui.button.css", "~/Content/themes/base/jquery.ui.dialog.css", "~/Content/themes/base/jquery.ui.slider.css", "~/Content/themes/base/jquery.ui.tabs.css", "~/Content/themes/base/jquery.ui.datepicker.css", "~/Content/themes/base/jquery.ui.progressbar.css", "~/Content/themes/base/jquery.ui.theme.css"));
@Styles.Render("~/Content/themes/base/css")
References :
http://stackoverflow.com/questions/20081328/how-to-add-jqueryui-library-in-mvc-5-project
Keywords :
References , Script , Bundle
@functions{ public string GetSomeString(){ return string.Empty; } } <h2>index</h2> @GetSomeString()
References :
http://stackoverflow.com/questions/6531983/how-to-create-a-function-in-a-cshtml-template
Keywords :
Method , ASP , MVC , View
<asp:TextBox ID="txtName" ClientIDMode="static" runat="server"></asp.TextBox>
References :
http://weblogs.asp.net/scottgu/cleaner-html-markup-with-asp-net-4-web-forms-client-ids-vs-2010-and-net-4-0-series
http://stackoverflow.com/questions/3304478/how-to-set-specific-id-for-server-controls-in-an-asp-net-web-form-that-is-using