Developer forum

Forum » Development » Running a standalone .net 4.5 solution inside a dynamicweb environment

Running a standalone .net 4.5 solution inside a dynamicweb environment

Daniel Kvistgaard
Reply

We have a .net 4.5 mvc solution that resides within a subdirectory on a client's server, view-able in the dynamic web file structure interface as this:

|
|- BellaCenterPdfGenerator
|- Images
|- System
|- Templates
|- ...
|- cache
|- Transhbin

The OurSolutionFolder folder has the standalone project, and requires it's own routing as per mvc to be able to take a url request and direct it to the appropriate controller and run the correct method such as displaying a view.

The solution works great on it's own on our development server, and dynamicweb runs fine on it's own on the clients server. However, putting the .net solution in the dynamicweb environment causes problems. It will give a 404 when we browse to the url:

http://bccph.net.dynamicweb-cms.com/Files/BellaCenterPdfGenerator/Magazine/index

We know that the .net solution can run, because if the Web.config of the standalone solution contains incorrect syntax, we can see a "Server Error in '/' Application." message when we browse to the url. However, if the web.config is okay, we see a 404.

We suspect that the routing that dynamicweb uses interferes with the .net solutions ability to route.

There is a forum post mentioned previously regarding running mvc along side dynamicweb, however the goal in the video and project is creating a custom mvc module for dynamicweb, rather than taking an existing standalone .net solution and being able to run it within dynamicweb's environment.

http://developer.dynamicweb.com/forum/development/how-do-i-implement-webapi-in-dw.aspx

Is there a way we can run our solution without the requirement of it being a dynamicweb module?


Replies

 
Klavs Martens
Reply

Hi Daniel


I'm not running MVC in a dynamicweb module, but in a custom solution, so I think thats the root of your problem. We haven't really tried to run MVC inside an application folder together with dynamicweb.

I guess its possible, but you still need a custom solution, so you can change global.asax to provide an ignore route for your application folder:

routes.IgnoreRoute("<APPFOLDER>/{*pathInfo}");

Dynamicweb is looking for the existance of (any) route data in the current request, to decide if it should proccess the request, or pass it on the ASP.NET routing engine. An ignore route would tell Dynamicweb to get out of the way, and ASP.NET would then (in teory) pass control over to the application folder and let it do its own routing.

But, like I said. This is uncharted territory. Let me know how it goes.


Klavs

 
Daniel Kvistgaard
Reply

Which global.asax are you refering to? I assumed it was GlobalSettings.aspx in the files root but this a xml file.

 
Klavs Martens
Reply

Hi Daniel

Sorry, I meant Global.asax.cs (or.vb). It should be in the root folder of you custom solution.

Klavs

 
Daniel Kvistgaard
Reply

There remains the 404 dynamic web message when we browse to the solution. I think providing some code may help you shed light on this problem. I was unsure if <APPFOLDER> was a keyword.

In my ftp client, the solution resides in '/html24dk/Files/BellaCenterPdfGenerator'

The url to the folder, along with the Magazine controller and Index method is 
'http://bccph.net.dynamicweb-cms.com/Files/BellaCenterPdfGenerator/Magazine/index'

My solution's web.config <system.web>
<system.web>
    <!-- <authentication mode="None"/> -->
    <compilation targetFramework="4.5"/>
    <httpRuntime/>
    <pages controlRenderingCompatibilityVersion="4.0"/>
    <customErrors mode="Off"/>
</system.web>


My solution's global.asax
<%@ Application Codebehind="Global.asax.cs" Inherits="BellaCenter.WebApiApplication" Language="C#" %>


My solutions global.asax.cs
using System.Web.Http;
using System.Web.Mvc;
using System.Web.Optimization;
using System.Web.Routing;
namespace BellaCenter
{
    public class WebApiApplication : System.Web.HttpApplication
    {
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            GlobalConfiguration.Configure(WebApiConfig.Register);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);

            RouteTable.Routes.IgnoreRoute("BellaCenterPdfGenerator/{*pathInfo}");
            RouteTable.Routes.IgnoreRoute("<APPFOLDER>/{*pathInfo}");


            RouteTable.Routes.IgnoreRoute("./Files/BellaCenterPdfGenerator/{*pathInfo}");
            RouteTable.Routes.IgnoreRoute("./Files/<APPFOLDER>/{*pathInfo}");


            RouteTable.Routes.IgnoreRoute("./html24dk/Files/BellaCenterPdfGenerator/{*pathInfo}");
            RouteTable.Routes.IgnoreRoute("./html24dk/Files/<APPFOLDER>/{*pathInfo}");


            RouteTable.Routes.IgnoreRoute("./html24dk/Files/BellaCenterPdfGenerator/{*pathInfo}");
            RouteTable.Routes.IgnoreRoute("./html24dk/Files/<APPFOLDER>/{*pathInfo}");


            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);
        }
    }
}

 

What would you recommend as our next course of action. 

404.png
 
Klavs Martens
Reply

<APPFOLDER> is where you put the the name you gave the subfolder in IIS.

 

I think we're getting a little out of scope for what we can helo you with in this forum. For trivial questions about ASP.NET / MVC / IIS, II suggest you use one the asp.net forums Microsoft offers.

Klavs

 

You must be logged in to post in the forum