Asp.net core iis 404 when controllers/views comes from different assembly

时间:2017-12-18 06:22:01

标签: c# .net iis asp.net-core

I have moves each Area with there controllers/views to separate assembly.Everything works fine until it's been deployed to iis which gives 404 error when trying to access the url that belongs to the controller from external assambly.I have followed all the steps from this post and What i have done in startup.cs

           //here assemblies are the external assemblies those contains view and controllers 
           foreach (Assembly assembly in assemblies)
            {
             services.AddMvc().AddApplicationPart(assembly);
            }
            services.Configure<RazorViewEngineOptions>(options =>
            {
                assemblies.ToList().ForEach(a =>
                {
                    options.FileProviders.Add(new CompositeFileProvider(
                                       new EmbeddedFileProvider(a)
                                   ));
                });
            });

This works fine in visual studio but after hosting on iis error 404 appears when trying to visit an area which belongs to external assambly

0 个答案:

没有答案