See files in root of site

Discussion in 'Site Programming, Development and Design' started by kipwoker, Sep 4, 2013.

  1. Hello. Here is my start page. :) I tried to publish my asp.net mvc 4 project. I used "Publish" in visual studio with FTP. What did I wrong?
    maththef.w11.wh-2.com - -.png
     
  2. Can you try publishing using WebDeploy instead? Using WebDeploy should ensure that all the necessary assemblies are uploaded to your hosting space as well as your site files.
     
  3. Yes, I tried it, but i've got same result. I solved this trouble, but I don't understand why this works. Look. I have this code in global.asax.cs file:
    Code:
    private static readonly object configurationLock = new object();
            private static volatile bool configured;
            private static IContainer container;
            private static ILog log;
    
            private void Configure()
            {
                if (!configured)
                {
                    lock (configurationLock)
                    {
                        if (!configured)
                        {
                            container = new Container(c =>
                            {
                                c.ForPlugin<IContainer>().ReusePluggable(ReusePolicy.Always);
                                c.ForPlugin<IController>().ReusePluggable(ReusePolicy.Never);
                                c.ScanLoadedAssemblies(assembly => (assembly.FullName + "").Contains("MyNamespace"));
                            });
    
                            var configPath = Server.MapPath("~/log4net.config");
                            log4net.Config.XmlConfigurator.ConfigureAndWatch(new FileInfo(configPath));
    
                            log = LogManager.GetLogger(typeof(MvcApplication));
                            configured = true;
                        }
                    }
                }
            }
    and I call Configure in Application_Start:
    Code:
    protected void Application_Start()
            {
                Configure();
                log.Info("Application started");
                AreaRegistration.RegisterAllAreas();
                ControllerBuilder.Current.SetControllerFactory(typeof(ControllersFactory));
    
                WebApiConfig.Register(GlobalConfiguration.Configuration);
                FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
                RouteConfig.RegisterRoutes(RouteTable.Routes);
                BundleConfig.RegisterBundles(BundleTable.Bundles);
    
                BundleTable.EnableOptimizations = true;
            }
    So I tried to comment Configure call like this:
    Code:
    protected void Application_Start()
            {
                //Configure();
                //log.Info("Application started");
                AreaRegistration.RegisterAllAreas();
                ControllerBuilder.Current.SetControllerFactory(typeof(ControllersFactory));
    
                WebApiConfig.Register(GlobalConfiguration.Configuration);
                FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
                RouteConfig.RegisterRoutes(RouteTable.Routes);
                BundleConfig.RegisterBundles(BundleTable.Bundles);
    
                BundleTable.EnableOptimizations = true;
            }
    And this solved my trouble, but I don't understand why I can't use log4net or DI framework?
    I tried comment only log4net configuration and only DI framework configuration, but it doesn't work. Comment both works for me fine, but it's bad solution, because it's very hard to support site without DI and logging.
    Have you some ideas what's wrong in my code? In my local IIS everything great.
     

Share This Page