Best practice developing using IIS and Visual Studio at the same time

Topics: General, MVC
Jul 18, 2011 at 8:23 AM

Hello everybody,

I have a fundamental question regarding the developent of a web site using C1.
The project is located in one folder on my machine and I'm accessing it either using
the C1 console (running on the local IIS) or when I need to develop/embedd an MVC
funktion I'm using Visual Studio 2010. So in short, Console and Visual Studio are accessing
the same path at the same time.
When pressing F5 in Visual Studio the project is just temporaily running on an IIS entity.
So in this case I have two entities of my C1 project running at the same time.
Is this the recommended way?

Thanks in advance

Michael

Coordinator
Jul 18, 2011 at 8:54 AM
Edited Jul 18, 2011 at 9:11 AM

Hi Michael

Mostly people do it one of the following 2 ways:

1) They don't use IIS while developing, using just visual studio Shift+F5 to run without debugging, F5 to debug

But IMO - there's no fun in that, once you have a bug you have to restart the site by clicking F5 so it is in debug mode, which is just loosing time. Besides Cassini (that's the name of service VS can use without IIS) runs only in "pipeline" mode, which works slightly different from "integrated" - the default mode for IIS.  So there's a change that you'll miss a bug because your hosting service (VS) is different from the one being used on a production server (IIS)

2) You can run site only in IIS, and for debugging - you can "attach" Visual Studio to the IIS working process, once you done with debugging, you "detach" Visual Studio.

Run site in IIS, in VS press Ctrl+Alt+p, find the process in the list (usually I just click "w", so it jumps to the first "w3wp.exe"), press "Enter", and than "Enter" again to confirm running under Administrator.

So it looks like: Ctrl+Alt+p, "w", Enter, Enter  - and you are "attached"

For detaching - Top Menu -> Debug -> detach from all processes

 

// Dmitry

Jul 18, 2011 at 2:46 PM

Hi Dmitry,

thanks for your reply but your answer seems to handle the debug part. I still do not understand
how to create own extensions, lets say MVC applications, using Visual Studio. Do I need to open the C1 project,
the one that is currently used by IIS, or should I develop in a separate project?

When I look at the Hello world MVC3 on the composite website it seems that they are using the same C1 project within
IIS and VS (http://docs.composite.net/C1/ASP-NET/HelloWorldMVC.aspx/Using-MVC-in-C1)

 

Michael

Jul 19, 2011 at 9:26 AM

Sounds like you've downloaded the source from codeplex and developing the site within the solution of C1. I wouldn't recommended this, what you should do is just to compile Composite and Composite.Workflows and then close the C1 solution again.

Instead you should always develop in your own Solution. I recommend copying the Website folder you got when downloading source from Codeplex but leave out the .vspscc, .project and ReleaseBuild stuff. Copy that folder over to a location of own choosing. The Build you did in the previous step will make sure the correct dll files did get copied to the bin-folder of Website.

Now you're ready to start. Open Visual studio, go to File > Open > Web site. Choose the location where you copied the Website folder to and press Open. Now, in the Solution you got you have one project in which you can start creating the Controllers and Views. If you want you can also refactor that into seperate dll's, by right-clicking on the Solution and choose Add > New Project and choose Class Library. After doing that make sure to right click on the bin-folder in the website, choose Add Reference > Projects > the project you just added. This will make sure the dll-file is copied to the bin-folder whenever you compile/build.

I can also highly recommend applying SP1 ti VS since this will give you the option to debug with IIS Express instead of Cassini.

Anyway, lots of basic Visual Studio guidance, nothing really to do with Composite C1 since this is the general approach for whatever websites you'll be developing. Never rely your projects on the solution files provided by any vendor but stick to your own scheme.