Two wwwroot on Azure - visual-studio

In my VS2015 environment I have a folder structure like this:
--/project
----/wwwroot
-------/js
-------index.html
----web.config
----project.json
...
...
When I publish my app to Azure, Azure puts everything under site/wwwroot. In this case I have two wwwroot folders, one under another. I don't mind this but my home page is not accessible. If I change the virtual applications/directories settings to point to site/wwwroot/wwwroot in Azure, I can see the home page but the application is not usable (WEB APIs, etc).
Any ideas on how to make this work?

You seem to have both web.config and Project.json.
So is this ASP.NET core or the legacy ASP.NET application? You will see another wwwroot in case of a ASP.NET core application.
See this article once on how to publish the web app: https://docs.asp.net/en/latest/tutorials/publish-to-azure-webapp-using-vs.html

Related

Hosting a website built with webmatrix

I had built a website using Webmatrix 3 and used the '.sdf' database. However, I couldn't use the web deploy technique since my host doesn't allow it.
The files have an extension of '.cshtml'
I've uploaded the files using ftp and when I open the link to those pages, they only show the code like they show when they are opened manually by double clicking on them not even on a localhost.
Is there a way I can host my website with the .sdf database?
Sorry, the ASP.NET Web Pages framework (the pages you're talking about '.cshtml') needs your to have the Web Pages framework installed so that they can run.
IIS needs the Web Pages add on to work with the .cshtml files, and to render the HTML using the Razor syntax, that you're trying to tell me. I remember, once I opened the .cshtml page using Opera Web Server, and it gave me the same error since it was not able to render the HTML and thought the code itself was the HTML.
The problem about the .sdf is that you cannot use it. If they don't support Web Deploy, I think they don't support the SQL Server CE database either. This means that you cannot use them.
As, alread told, you can only ask your hosting service provider for help in this scenario. They can guide you further. Or can forward you to some other branch where these services are supported.

Not able to deploy MVC3 to IIS correctly

I've followed the steps to bin deploy my MVC3 application into IIS7, but when I browse it after deployment, it is showing me a list of file similar to ftp website instead running the pages.
The dlls that are explicitly added in the bin folder of my application are:
Microsoft.Web.Infrastructure
System.Web.Abstractions
System.Web.Helpers
System.Web.Mvc
System.Web.Razor
System.Web.Routing
System.Web.WebPages.Deployment
System.Web.WebPages
System.Web.WebPages.Razor
I set security to everyone full control to test, so its not a security issue for sure
and when I try to navigate to home/index for example, IIS wont recognize the path, see error below:
.net 4 is installed, application pool of the website is .net 4 also
not able to find solutions
What I am missing to do, any suggestions ?
Thanks
In order for IIS (this only applies to IIS 7+) to process MVC request, the easiest option is to set your Application Pool pipeline to Integrated instead of Classic. Without giving an MSDN level reason as to why this is, essentially classic mode wants every request to have a file extension. If the request does not have a file extension, IIS will go look for that directory. Integrated mode allows the request to go into the ASP.NET pipeline, which will then trigger your routing in your MVC site and the dynamic content will appear.

Sharing AppSettings and ConnectionStrings between a console and a web app

I have a multi-tiered ASP.Net MVC 3 application in which different layers need to share some settings, and I am wondering how to best achieve this.
For now, all my AppSettings are in the Web.config file, but I just added a new project to my solution to create a console application that will be called every night buy the Windows Task Scheduler to perform routine maintenance tasks. This console application will be using the same database, repository layer, service layer, etc. as the web application, and both applications should share the same settings for the most part. I would like to avoid duplicating the settings in two files (app.config and web.config).
Also, I want these settings to be available to the service layer, which is in a separate project in the same solution.
I have read the following post, but I don't fully understand the solution, and I am not sure it is the best way to do this.
Sharing Config settings between Web App and Console App
I also read the article linked to by that post, and I don't find the solution very elegant.
I am using VS 2010 and EF 4.3.1.
If you're simply interested in accessing the AppSettings of your web.config file from a console app, that's simple enough. The only real annoyance is that since your console app won't be running in a web context, you will have to know in advance what your site is called in IIS. This being your own application shouldn't be a challenge.
Just use System.Web.Configuration.WebConfigurationManager to open and access the web.config of the specified site.
The idea is that you could put the settings into a common .config shared between all your projects as a link instead of putting it in all projects. The solution is outlined in this answer. Also checkout the configSource property on MSDN if you are not aware about the possibility of externalizing configuration elements into a separate file.

Deployment to a shared web server causes my relative links to break

I'm new to MVC3 and have the feeling this may be an obvious problem but nevertheless I can't find a related question on the issue.
I'm developing a web site in MVC3. My production environment has several web sites positioned as follows, eg:
www.companywebsite.com/app1/
www.companywebsite.com/app2/
...to
www.companywebsite.com/mynewapp/
I'm using IIS on Windows server2008 and have created the "mynewapp" folder. But when I deploy my application into this folder all my relative links and files break.
I've converted my scripts and images to T4-MVC references which seems to handle the relative paths but any bog-standard hyperlinks that I have as relative links will not work (and I don't want to convert them to Razor links due to use of images).
All my mapped routes are working fine without change.
Is there a global setting I can use for deployment to the production environment which will tell my project that the base folder is /mynewapp ??
Thanks in advance.

Deploying Asp.net MVC web application

I have been trying to find a neat tutorial, guide or step by step instructions for deploying an Asp.net MVC3 webapp but have found nothing so far. Everyone talks about his version of the stroy and different type of MVC versions.
Right now, I have build a simple Asp.net MVC web application which i need to deploy on my shared hosting account. In a very simple manner, I need to know which files should i copy. Do i upload everything in my webproject directory to the server including the controller directory, views, models, content and bin directory ?. What about the Global.asax, web.config, packages.config, myapp.publish.xml.
In short, I have no idea which files should be uploaded and which should be not. I am sure of one thing that i need few(MVC and Razor dlls) following dlls in bin directory. Just treat me as someone who has never deployed any website
NOTE:- I don't have VS SP1 installed and it doesn't install either. Basically i need a manual procedure.
Here is a tutorial on the MSDN site about how to deploy an MVC application. Typically, hosts will also now have WebDeploy available, which is a very easy way to deploy and update your application without having to worry about what files to copy.

Resources