Visual Studio allows you to make "Web Sites" and "Web Applications", but, inside a project, can you have one within the other?
Say I have my website "www.mysite.com" and I have an application called "BudgetCalculator". One the production server, this is supposed to be located at:
www.mysite.com/BudgetCalculator
And the BudgetCalculator app contains links back to other parts of the website, like "/page1" and "/page2".
However in Visual Studio, when they're listed as two different projects, they're on the same level. When I fire up the debugger for the BudgetCalculator app, those links aren't going to point back to the main website, like they should.
Is there a way around this?
One solution would be to stop using the built-in .NET Web Server.
Use IIS, create one site, and make your Web App a Virtual Directory inside of the Web Site.
A project cannot host/contain another project in Visual Studio.
You can however create a project that sites in the directory of another higher level project when you create it, however they may not be directly linked, so you couldn't debug them both at the same time.
Related
I am working with Virto Commerce server 2.4.561 and I'm having a great deal of difficulty successfully publishing to Azure from Visual Studio. Based on the documentation provided, it's not clear to me what the appropriate method is. Most guidance related to Azure assumes that I am using Git deployment. But in this case I am not. I am coding locally on my dev machine and I would like to be able to use web deployment to deploy directly to Azure from Visual Studio. However, the guidance found here seems to suggest that if you want to do your own deployment, you need to use deploy.cmd. I'm not exactly sure why that is. I can only guess that it has something to do with how the modules need to be packaged up.
I am able to run deploy.cmd and it appears to succeed, but I end up with an artifacts folder with 2,000+ files and folders in it and I am left to use old-school FTP to sync all those files up with the Azure website. Is this how it is meant to be done? I have tried to deploy directly from Visual Studio to Azure, and it appears to succeed, but the site does not behave correctly. Specifically, the custom modules I've built don't load correctly.
What is the right way to do this?
There is a way to publish your custom module directly from Visual Studio, but you still need a working Virto Commerce in Azure beforehand, and the easiest way to set it up is to use the Deploy to Azure button in GitHub.
In the Azure portal create a new virtual application /MyModule with
physical path site\wwwroot\admin\Modules\MyModule. It will be used
for publishing a custom module.
Download the source code from GitHub with the same version as you have published to Azure, add your custom module to the solution and build it.
In Visual Studio right-click on your module project and select Publish.
On the Profile screen select Microsoft Azure Web Apps as a publish target and select your Azure Web App.
On the Connection screen select Web Deploy as a publish method and add /Module to the site name. So your site name should look like this: myvc/MyModule.
On the Preview screen click the Start Preview button and make sure the file list contains only files related to your module and the action is Add for each of them.
When you click the Publish button, Visual Studio will upload all module files to the physical directory configured for the virtual application myvc/MyModule. For subsequent publishing it will upload only modified files.
Update: You should restart the Web App via the Azure portal after publishing in order to load the new version of your code into the application. Thanks to N1njaB0b for reminding.
This may be a basic question, but I've searched for a little while and couldn't find anything specific to this.
I bought a domain and created the web app in Azure for hosting, and set up the DNS so that it's linked to the Azure Web App. Using Visual Studio 15, I opened the website via the FTP connection settings found in Azure, and was able to create files, edit the html, css, etc. Going forward, I wanted to use Web Deploy with Visual Studio to push new builds of the code up to the web site. I downloaded the publish profile from Azure, and imported it into a new visual studio project. I also copied all the previous files over(it wasn't alot). I got the correct Web Deploy settings and successfully published the solution to the Web App in Azure. However, it never updates the code with my new changes. When I look at the site in Firebug it still has the same files/code that it had when I edited it via FTP.
Any idea what I'm doing wrong?
I followed your steps and everything published perfectly for me. Did you try to simply refresh the file list to make sure Visual Studio is seeing all your files? Are they included in your project?
Also, when you go to publish, on the 4th step labeled preview, try to hit "start preview" and see if it detects any changes.
Also, could you tell me a bit more about your project? Is it a website project folder, mvc solution, etc?
You could try to clean the website to make sure your new files are getting deployed.
Clean Windows Azure Website
I have an Azure Cloud Service Project that has a web role with multiple websites associated with it.
When I click the "run" button, it fails to load the debug symbols for all the websites in the web role. In order to debug the other websites, I have to explicitly build the web project in question before I can run the debugger.
How can I configure the Azure Cloud Service Project to compile all the associated webs within a single web role?
As of this posting, Visual Studio 2012 support for multiple websites within a single web role is fairly poor (Exibit A, Exibit B).
When you click the "Run" button in a solution, it doesn't mean that all projects will be compiled. Only those directly related with the project that is being run at the moment will be compiled (and debug symbols updated).
Consider the following work-around:
Identify the main web role web project in the solution (it should the one that
matches the name of the web role in the Azure Cloud Service Project).
Right click on the web project
Go to "Add Reference"
Go to "Solution"->"Projects"
Check the checkbox next to each of the web role's associated websites.
Click OK
By adding a reference to the other web projects, it causes the compiler to compile the other webs when the Azure Cloud Service Project is run with the debugger.
This will allow you once again hit the "run" button with great abandon.
I've posted some details on using multiple web sites within a web role on my blog at http://michaelcollier.wordpress.com/2013/01/14/multiple-sites-in-a-web-role/.
As for the debugger, are you using host headers for the different sites? If so, try switching to use different ports instead. I've had better luck going that route for debugging purposes. Then switch back to host headers when ready to deploy.
I recently upgraded from VS 2003 where I was working on a ASP.NET 2.0 website to VS 2010 where I have migrated to ASP.NET 4.0. So far it has been a big headache to get my site compiling with the new version. One problem was that my aspx.cs pages could not find the shared code libraries in my project. I solved this by moving my shared code to the App_Code folder (if there's a different/better way to do it please let me know).
Another issue that I am finding confusing is with pre-compilation. With VS 2003 I could click the build project button and it would precompile my site into a myweb.dll and myweb.pdb files. Now I'm having trouble doing the same in VS 2010. When I build the site in VS 2010 the dll is not created. I did manage to find an option to "Publish" the site which takes forever (like 2 minutes) and involves duplicating the site to another folder. This would have been acceptable but instead of making the single DLL file, it makes a bunch of files: App_code.compiled, app_code.dll, App_code.pdb, App_global.asax.compiled, App_global.asax.dll, App_global.asax.pdb, App_Web_lrpcway1.dll, App_Web_lrpcway1.compiled, App_Web_lrpcway1.pdb.
The application works - I can deploy it with all these files. However, I'd really like someone to explain what are the extra files and if there is a better way how to do it.
Thanks
This is the difference between a website and a web application.
You can convert your website to a web application to have it
behave more like you are used to.
The files in appCode are compiled when required to run and thus
does not provide dll.s in the bin/debug folder, but they should
be created when the application actually runs (but it is not
put in the same location).
Here is a nice write up about it Link
You can use the ASP.NET Merge Tool to combine all of the little DLLs into one big one.
http://msdn.microsoft.com/en-us/library/bb397866.aspx
In dreamweaver, it's really simple to set up a site so when you test a page that you are developing that it deploys it to a different test server that you are developing on and then browses to that page at that location also.
Question: Can you set up Visual Studio so that when you "run" or "View in Browser" that it automatically pushes the pages out to the test server and then browses to that location as well?
You've got two options as far as I can see:
1) Create a local project and set it up to run from your own local IIS, (this is not exactly what you're asking, but it should be more of an apples to apples test, as opposed to the built-in visual studio web server).
2) Use Remote Debugging to attach your Visual Studio instance to a remote server, links here and here
With option two, you'll still likely need to publish/deploy your solution to the server each time, but you will be able to step through and debug your code running on the remote server.
I think you can use an FTP project (File>Open Web Site and then select FTP) - as far as I'm aware, when you save a file it's automatically uploaded to the specified server. Then you could just point your browser at that web server.
I don't think this is possible,but you can always set up a shared folder where you put your code, and that shared folder is in fact the folder where your web server expect the code to be.