Wordpress blog inside an Asp.net MVC site - asp.net-mvc

I have an ASP.NET MVC 3 website hosted in a shared server.
I want to create a WordPress blog in /blog (www.domain.com/blog).
I've created a Virtual Directory in my admin panel pointing to the blog directory which has all the WordPress files.
When I navigate to www.domain.com/blog, I am receiving the following error message:
Could not load file or assembly 'System.Web.Mvc, Version=3.0.0.1, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
So:
Is it possible to have a Wordpress blog (PHP) running in /blog?
Is this approach (Virtual Directory) correct? If yes, how to fix this error?
If it is not correct, how could I get /blog running?

I'd like suggest a different approach, that I did with my project and seems to be a stable solution.
Create an area "Blog" in your existing ASP.NET MVC project.
Use this pretty simple repo to create front end of blog into that area. Ignore admin part.
https://github.com/VJAI/JustBlog
Use Wordpress API's as your data engine to to populate data in your newly created area.
https://developer.wordpress.com/docs/api/
Edit robot.txt of your original Wordpress blog and stop it from being crawled by search engines. If possible put old wordpress blog under maintenance mode as well.
You will have your new blog at www.mywebsite.com/blog

You'll need a virtual application not a directory. Furthermore, your host must have PHP configured properly for IIS; not all do this.
Lastly, you will likely need a web.config file in the blog directory to "undo" any ASP.NET configuration inherited from the root. This will be specific, based on your root app. Give it a try without worrying about this first.

Related

How to move entire ASP.NET MVC website from www.test.com to www.test.com/xyz

We have an ASP.NET MVC website that runs happily at eg. www.test.com.
We would like to shunt it to a subfolder on www.test.com/xyz. Anyone visiting the root should get nothing - we are quite happy if the root location 404s or is blank or just shows a holding page index.htm. Basically we want to crudely obfuscate the site's new xyz location.
We don't have access to IIS on the hosting so would like to do this all just by moving the files around (and perhaps editing web.config).
From research done here on similar questions it seems that location of web.config is crucial. Ours is the version built by Visual Studio when generating a new MVC application so 140+ lines of configuration which we don't normally mess with too much and haven't had to understand in depth.
What we have tried:
web.config in the subfolder only
web.config in the root only
Neither of these above attempts work. e.g. if the web.config is in the root only we get an error:
Could not load file or assembly 'Microsoft.AspNet.TelemetryCorrelation' or one of its dependencies. The system cannot find the file specified.
at www.test.com, and a 500 error at www.test.com/xyz
I sense we need to split web.config and have some of it in the root (the bare essentials?) and the rest in the subfolder, but I am far from sure of the syntax.

MvcSiteMapProvider Localization in an Azure Web App

I localized my sitemap with the instructions provided here. The same way it is recommended in this post. In my local enviroment it works perfectly. However, when I deploy my app to Azure, the resource file cannot be found. I know that the resources files inside the App_GlobalResources folder are not included in the project.dll, but I don't know how to localize my sitemap without using the resource files inside that folder. Do someone experienced the same problem and has a solution?
Unfortunately, Visual Studio doesn't setup the default settings on App_GlobalResources to deploy them with MVC.
Options
Implement IStringLocalizer yourself in order to provide localization from within your project or another assembly.
Implement your own ASP.NET 2.0 resource provider. See examples here and here.

Deploy MVC 3 Site From LocalHost to IIS (Directory Listing Denied)

I have my site at:
http://localhost:55649/
I want to move it to:
\\10.0.0.169\Inetpub\wwwroot\MyOldWebsite\NewSite
I read this http://haacked.com/archive/2011/05/25/bin-deploying-asp-net-mvc-3.aspx and clicked "Add Deployable Assemblies" but I get the error:
Directory Listing Denied
This Virtual Directory does not allow contents to be listed.
What can I do to fix this error to make the site work?
When you get that message it tends to be because routing isn't working and the site is trying to find a default document (which in MVC3 doesn't exist). If routing isn't working that generally means IIS isn't interpreting it as an MVC3 site or doesn't know what an MVC3 site is.
Does your server have .NET Framework 4.0 and MVC3 installed?
Is your site using a .NET 4.0 application pool?
Does your new directory have the proper permissions? Depending on the application/server security this can change. But generally IUSR needs read access.

Hosting an MVC and a webforms site on the same IIS7 instance - web.config inheritance

We have a website that was written in classic ASP, then I started to extend it using web forms. These extensions exist in a subfolder of the main folder. Now we've decided we'd prefer to use MVC3. Also, as we'd like to convert all our site to MVC3 over time, we are hosting the MVC code in the application root. I've found some other questions where people have a similar issue to mine, but no solution. The issue is simply that my web forms app can't seem to be stopped from inheriting the web.config settings from the root folder, and as a result, it won't run, it either complains about missing dlls, or complains about running the wrong version of .NET, or complains I need to remove some settings ( which I try and can never get to work right ). The app in the subfolder is also hosting a webservice that is called by our application, and it also runs HTTP handlers to protect our imaging content, so it's got a bit of stuff in it. Do I need to run my MVC site in a subfolder ? Is there any way to have MVC in the folder above a web forms app ? I'd prefer to set things up so they share session data, but that's looking likely to be impossible at this stage...
So to be clear the folder structure is:
<root>
contains asp site and MVC site.
<subfolder>
contains webforms application
</subfolder>
</root>
and my issue is getting the subfolder to run, preferably in the same session as the MVC app.
There is no reason you can't run regular .aspx files on an MVC site. You are correct though, web.config settings are inherited from the parent (chain), but you just add a new web.config in your directory with relevant settings.
What you will have to do is play with the routes, because by default MVC will route all requests into your controller classes. But if you google around its fairly simple to add an exception to the routing.
If you post some of the specific errors we can probably help further.
Oh and do you mean Classic ASP? i.e. not Classic ASP.NET? Because you'll have fun sharing session data between ASP & ASP.NET.

What is the proper way to deploy Orchard CMS to shared hosting?

I've created a basic website using the Orchard CMS, and attempted to deploy it to my shared host, Softsys, using Web Matrix (via FTP). Currently, the site technically "works", however it looks like all styling has been removed (even from the dashboard).
Is there a step or files that I missed while deploying the site? I know "Web Deploy" is probably the preferred method of deploying, but I'm pretty new to this, and was not sure what the login specifics were, or how to obtain them for web deploy.
Here is a screenshot of what the site currently looks like deployed:
Edit: it turns out that the problem was on my host's side, for some reason the virtual directory was not being created properly - I still am curious what the proper/best practice method to deploying is however.
It looks like you have no theme applied. Check whether you have your theme existing in ~/Themes folder and properly enabled in the admin Dashboard. Maybe the /Themes folder content hasn't been copied?
UPDATE
If your hosting provider allows the option to deploy sites via WebDeploy - that would be the best one.
The easiest and most straightforward way to deploy Orchard site is to:
Have the ASP.NET application properly configured in IIS and accessible. If you use hosting - provider does that for you. If you'd have a dedicated server - you have to set up an application yourself.
Grab the deployment package from Codeplex, or build one from the sources.
Copy the whole package to your site's root (via FTP or WebDeploy).
Run it and proceed with the setup.
Basically - these are the same steps as for every "ordinary" ASP.NET application.
You probably need to set IIS user to have write access to some of the folders: Themes, Media and App_Data.

Resources