MVC Application ViewEngine sucht nicht in Bereichen/{Name}/Ansichten stattdessen in Standard -Ansichtsordner suchenHTML

HTML-Programmierer
Anonymous
 MVC Application ViewEngine sucht nicht in Bereichen/{Name}/Ansichten stattdessen in Standard -Ansichtsordner suchen

Post by Anonymous »

Ich benutze 2017 VC für Mac, die Xamarian -Version von VS hat nicht den Auto -Bereich Mapper. Ich habe den Ordner der Bereiche manuell hinzugefügt und das Routing ordnungsgemäß konfiguriert. Wenn ich meiner Haupt -CSHTML -Seite einen ActionLink hinzufüge, werfen sie einen 500 -Fehler und die Angabe. < /P>

Code: Select all

System.InvalidOperationException
The view 'Billing' or its master was not found or no view engine supports the searched locations. The following locations were searched:
~/Views/BillingMain/Billing.cshtml
~/Views/BillingMain/Billing.vbhtml
~/Views/Shared/Billing.cshtml
~/Views/Shared/Billing.vbhtml
~/Views/BillingMain/Billing.aspx
~/Views/BillingMain/Billing.ascx
~/Views/Shared/Billing.aspx
~/Views/Shared/Billing.ascx
Stattdessen sollte es in ~/rächen/Abrechnungen/Ansichten/BillingMainController suchen.

Code: Select all

Project-
AppStart-
Areas-
Billing-
Invoice-
Controllers-
Scripts-
Views-
Global.asax
< /code>

Ich teste nur den Abrechnungsbereich, im Folgenden ist der Rest meines Codes.using System.Web.Mvc;
using System.Web.Routing;

namespace WORK_GODDAMN
{
public class RouteConfig
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
//AreaRegistration.RegisterAllAreas();
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
//,namespaces: new string[] { "WORK_GODDAMN.Areas.Controllers" }
);

}
}
< /code>

} < /p>

BillingArearegistration.cs

using System;
using System.Web.Mvc;

namespace WORK_GODDAMN.Areas.Billing
{

public class BillingAreaRegistration : AreaRegistration
{
public override string AreaName
{
get
{
return "Billing";
}
}

public override void RegisterArea(AreaRegistrationContext context)
{
context.MapRoute(
"Billing_Default",
"Billing/{controller}/{action}/{id}",
new {controller = "BillingMain", action = "Index", id = UrlParameter.Optional }
, namespaces: new string[] { "WORK_GODDAMN.Areas.Billing.Controllers" }
);

}
}

}
< /code>

global.asax

using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
using System.Web.Http;

namespace WORK_GODDAMN
{
public class Global : HttpApplication
{
protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();
RouteConfig.RegisterRoutes(RouteTable.Routes);
GlobalConfiguration.Configure(WebApiConfig.Register);
}
}
}
< /code>

main _layout.cshtml Hier leitet der Aktions -Link weiter und glaube, ich mache hier vielleicht etwas falsch, aber an diesem Punkt habe ich keine Ahnung, was das [url=viewtopic.php?t=26065]Problem[/url] verursachen könnte. < /p>




@using System.Web.Optimization



@ViewBag.Title
@Scripts.Render("~/Scripts/modernizr.js")




{Demo}- Pluggable Modules

@Html.ActionLink("Home","Index","Home", new {Area=""}, null)
@Html.ActionLink("Invoice","Index","InvoiceMain", new {Area=""}, null)
@Html.ActionLink("Billing","Index","BillingMain", new {Area=""}, null)



@RenderBody()


@Scripts.Render("~/Scripts/jquery.js")
@RenderSection("Scripts", required: false)


Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post