Can I run an ASP.NET app in a virtual directory under an OrchardCMS instance - asp.net-mvc

As the title suggests, we are tasked with running a custom .NET MVC application in a virtual directory under the client's Orchard CMS installation. Now, I've successfully done this type of thing in the past with two custom .NET MVC applications, but never with Orchard. Orchard does some unique things behind the scenes, so I do not believe it would be possible.
Two things:
1. I can't build a new Orchard instance from source.
2. It must be a virtual directory on the same domain for SEO purposes. Running the site on a subdomain is bad for Google rankings. Therefore http://www.example.com/myportal is good, whereas http://myportal.example.com is really bad.

Yes you can. While this isn't specific to Orchard, you're likely going to run into some issues with web config inheritance. Depending on the individual scenarios you face (such as shared assemblies but different versions...duplicate config nodes etc) you should be able to search around on stackoverflow and resolve those easily though.
Resource: Virtual directory inside Orchard web application

Related

ASP.NET MVC website NOT in virtual directory

I have deployed three mvc pages to my server as virtual directories using IIS (which there are plenty of tutorials for). I need one of the apps to run when the base URL is requested. So, for example, I have a Help app which can currently be accessed via help.contoso.com/help but I want that app to run when a user simply goes to help.contoso.com instead. I gather there is some sort of redirect option but can't find an example for this type of request anywhere (they're all way more complicated and don't address my simple need). I also think there should be a way to just host the app as the 'root' web 'page' but can't find anything around that either...

Multiple Web Roles inside one Cloud Service?

In my mvc application adding one web role(same project with another web role) in service definition file, but am getting an error like "No Project Associated with(webrole name)".
My query is,
1) Is there any chance to run the one project with two web roles?
2) Presently my application is working one web role with one instance and VMsize="small".but my application running with low performance.
3)Is there any chance to increase the application performance by increasing the number of instance in the role?
Thanks,
PCSSCP.
The error "No Project Associated with ..." means that you have specified the existence of another web role, but there is no project in your solution (ASP.NET webproject, MVC project) that should be deployed as that webrole. Make soure you have two web projects in your solution, when using two web roles.
As an alternative you can deploy to web projects in a single web role.
Increasing the VM size gives your web role more resources (CPU speed, RAM, ...) to perform, which might increase the performance experience for visitors.
Using more instances won't make the application faster, but since all requests are shared amongst the instances, you can serve more users at the same time.

Suggested approach for creating asp.net MVC and WCF service application

I am working on a web service which is going to have both a native WPF client as well as a Javascript based web interface.
While I was working on the service and WPF client, the WCF service has been an IIS hosted WCF service project of its own, and has been working fine. Now that I'm starting to work in earnest on the web interface, I am wondering if keeping the WCF service separate is a good choice.
Reading around on the subject, there seem to be lots of options regarding this; for example, I could:
Keep the two projects separate
Create the asp.net MVC website and add an Ajax-enabled WCF service to the project
Create the asp.net MVC website and add a WCF service to the project
Create a WCF service library project and have that hosted in the MVC application (not entirely sure about this, but it seems possible)
And I have a feeling there's probably more.
What do you suggest I should do? My goals are:
Accessing the service from the WCF client using a service reference like I have done so far
Accessing the service from Javascript on the web interface
Accessing the service using port 80 from Javascript and the WCF client (to avoid firewall issues)
Having website and service under the same domain
Being able to run the thing using shared hosting (Gearhost), without multiple IIS virtual directories/application starting points.
Recommended: I would suggest keeping the projects as separate as possible. It allows more flexibility in how everything can be hosted if your app takes off and you need to separate to different servers/app pools/etc. Also, separation of concerns is one of the Service Oriented Architecture (SOA) tenets. This will force you to code your service in a way that is "generic" enough that might promote re-useability down the line. Forgive me if this is below you but I need to say it: In visual studio you can create an empty solution and add in each of your individual projects so you are working all within one instances of visual studio.
Then in your IIS instance you would have something like this:
/ = root app
/servicelayer/ = virtual application
But... you have a goal of "Being able to run the thing using shared hosting (Gearhost), without multiple IIS virtual directories/application starting points." You cannot host separate asp.net applications within a default IIS directory without marking them as virtual applications. This means you can not just paste the servicelayer application folder into your root application folder.
Because of that requirement then the only option you have is to add your service code into your asp.net mvc application. I'd create a folder called "/services/" that houses all your endpoints so that it's slightly separated. Then add an Ajax-enabled WCF service to that folder.
In the end I decided to create three projects: the service interface, a dll holding service and data contracts, the service library itself, which references the interface, and the website, an MVC application which hosts the created service library. The MVC code interfaces with the service as if it was hosted on a different system, using a client proxy (which in this case connects to itself, funnily enough). This should allow me to host the whole thing in a single virtual directory while still providing for not-too-painful decoupling down the line if need be. To keep things tidier, I am creating the service proxy manually in code by referencing the interface dll and NOT using the "add service reference" function.

Can ASP.MVC 3 run in a site root and allow other ASP.Net apps to run in subfolders?

Can I have an ASP.MVC 3 application running in my site root (a simple CMS to provide MOST site content), and have it co-exist with additional ASP.Net apps (2 Web Forms apps and 1 MVC app) running in subfolders to provide more specialized functionality?
Example:
www.mycompany.com
/ // ASP.MVC 3 App goes here to handle 90% of our page content.
/store/ // Older web forms app to handle our online store.
/survey/ // Older web forms app to provide survey forms.
/locations/ // An ASP.MVC 3 app to render a map with site locations.
I wouldn't mind integrating the 'locations' MVC app with the CMS if necessary, but if they can be separate, it would simplify long term maintenance. Does the root application need to know about the others? (including the other projects as subprojects into the main MVC project in VS.2010?)
As for the 'store' and 'survey' Web Forms apps. They are running .Net 3.5, but we could recompile them to 4.0 if needed. Do the 'store' 'survey' and 'locations' folders need to be virtual folders mapped in with IIS?
Hopefully this example is simplified enough, to find out if it is possible (and how) to integrate applications together with ASP.MVC 3 running in the site root. I'm in a situation where the separate apps must share a domain and pretend to be 1 cohesive site. (They will all share the same HTML template)
Just mark those other applications as Applications in IIS and that will do.
Not directly -- you'll be fighting nasty IIS battles all week methinks. You might be able to get there eventually but it won't be pretty. There are two potential approaches here:
a) Put the entire thing behind a reverse proxy that passes traffic to the appropriate server (or virtual server). Downside is you might have to do a little tom-foolery to convince IIS that your store is running at http://www.example.com/store instead of http://localhost:666/store but it is doable.
b) Try and incorporate the old webforms apps into your MVC cms app. Really depends on lots of specifics but could be as easy as setting the route to be ignored and tweaking config as appropriate.

Windows Azure & ASP.NET MVC site deployed on it?

is it possible to deploy asp.net MVC site on windows AZURE platform? I understand we can deploy a WCF service, but what about full site? Will it work? Will it scale (i.e. load balance)?
We're having a project to develop - a donation site, which will be advertised a lot and will receive a lot of traffic. I do want to try AZURE, but is it possible for AZURE to run the full asp.net mvc site?
Yes - you just need to make sure that MVC dlls are copied to bin folder and MVC project is added as a web role.
Here's a tutorial.
Also take a look here:
MVCCloudService
PS. Remember about Azure prices.
As others mentioned, MVC2 sites are totally OK for Azure. Your second question: will it scale (auto-balance) needs more explanation:
If you have more then one compute instance (VM) allocated to your application, MVC2 site will auto-balance provided you haven't made any mistakes with keeping session-information inside the URLs.
However, if you want to automatically adjust the number of compute instances per load on the site, you will either have to write the scaling logic yourself (check this site to get started http://convective.wordpress.com/2010/10/12/autoscaling-in-windows-azure/ ) or use a third-party scaling engine like # http://www.paraleap.com/
HTH

Resources