-
Notifications
You must be signed in to change notification settings - Fork 5
before you run the solution
Before following the steps below, be sure you have gone through the steps outlined in the before you open the solution wiki page.
The very first time you open the solution, you may see a message similar to the following:
The local IIS URL http://localhost:1976/ specified for Web project UCosmic.Www.Mvc has not yet been configured. In order to open this project the virtual directory needs to be configured. Would you like to create the virtual directory now?
When you see this prompt, click Yes. Don't worry if you clicked no the first time. Just close the solution and re-open it. Visual Studio will keep showing you this prompt until the IIS Express virtual directory is created.
In Visual Studio, click File > Open File, navigate to My Documents/IISExpress/config, and open the applicationhost.config file. With the file open, hit CTRL + F to open the Quick Find window, type 1976 into the "Find what" text box, and click Find Next. This should jump you down several lines in the file to a section that resembles the following (though your site name, id, and physical path my be slightly different):
<site name="UCosmic.Www.Mvc(1)" id="2">
<application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="C:\Code\GitHub\ucosmic\Apps\UCosmic.Www.Mvc" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:1976:localhost" />
</bindings>
</site>
The above entry was created when you clicked "Yes" to have the IIS virtual directory set up for you. However, much of the UCosmic system operates using HTTPS and SSL, and we may soon change the entire application to run over HTTPS instead of regular HTTP. Because of this, you need to add a new binding entry. Modify the <bindings>
section so it looks like the following:
<bindings>
<binding protocol="http" bindingInformation="*:1976:localhost" />
<binding protocol="https" bindingInformation="*:44376:localhost" />
</bindings>
This means that when you start up UCosmic in IIS Express, it will run over HTTP at port 1976, and over HTTPS at port 44376. There are more advanced IIS Express SSL setup steps that you will come to later, but for now this should help you at get the app running over SSL quickly.
Before you build the solution, make sure you have a working Internet connection. UCosmic uses dozens of NuGet packages, however they are not checked into source control. Instead, the solution has enabled the NuGet package restore feature. This means during your first build, NuGet will go out and download all of the packages it needs to your local working directory. This is why you need to be connected to the Internet.
If you find that the solution does not build because of missing references, right-click the solution in the VS Solution Explorer and select "Enable NuGet Package Restore". For more information about this feature, read this.
Before starting the solution, make sure you know how to set & change the startup project. Right click the ucosmic solution in the VS Solution Explorer and click Properties. On the left, select Startup Project under Common Properties. Then on the right, select the "Single startup project" radio button and choose UCosmic.Www.Mvc from the drop down menu. There may be other times when you want to change the startup project to UCosmic.Cloud.Azure to run the app in the Azure DevFabric emulator, but for the most part, develop using the MVC project as the startup because it is much faster.
UCosmic is developed against an instance of SQLEXPRESS. To run it, you need to make sure you have a Microsoft SQL Server or Express instance with this name. If you do not, it is preferable to install an instance under this name. Otherwise, you will need to change various project connection strings each time you checkout the project to work on it, then restore them before creating a pull request to have your work merged back into the master repository.
Open the web.config file in the UCosmic.Www.Mvc project and scroll to the connectionStrings section. Here you will see 2 connection strings: 1 for ApplicationServices, and 1 for UCosmicDev. The UCosmicDev database is used for application data, and will be automatically created for you. However, you will need to create the ApplicationServices database manually.
In SQLEXPRESS, create a new database named ApplicationServices. Next, run the aspnet_regsql tool against this database:
- In Windows Explorer, navigate to C:\Windows\Microsoft.NET\Framework\v2.0.50727
- In this folder, double-click the aspnet_regsql.exe file.
- An ASP.NET SQL Server Setup Wizard dialog will appear. Click next.
- Make sure the "Configure SQL Server for application services" radio button is selected and click Next.
- In the Server text box, enter .\SQLEXPRESS
- In the Database drop down menu, select the ApplicationServices database you already created.
- Click Next, read the message, then click Next again. This will set up your ApplicationServices database with the tables, views, and stored procedures used by the Microsoft SQL Providers.
In addition to the Microsoft SQL Providers, UCosmic also uses the ApplicationServices database for ELMAH error logging. You do not need to set this up, but it is very easy and helpful to have a record of exceptions thrown as you develop. To set up ELMAH, open the ElmahSqlSetup.sql file located in the Etc folder. Create a new SQL query for the ApplicationServices database, copy the contents of the ElmahSqlSetup.sql file into it, and execute. This will create a table named dbo.ELMAH_Error along with some stored procedures in your ApplicationServices database.
Before running the app, there is one more step you may want to take. Right-click the UCosmic.Www.Mvc project in the VS Solution Explorer and click Properties. On the "Web" tab, under "Start Action", make sure the "Don't open a page. Wait for a request from an external application" radio button is selected. This setup prevents VS from opening a new browser window each time you start the app, and also prevents VS from stopping IIS Express each time you close that browser window.
Now you should be all set. In the top menu bar in Visual Studio, click Debug > Start Without Debugging. If everything goes successfully, you should see the following alert pop up:
Choosing to wait for a request from another process without enabling ASP.NET debugging results in nothing to debug.
Don't worry, this alert dialog is normal, and is the result of selecting "Don't open a page" for the project Start Action. Just dismiss this dialog. When you start the app with debugging, you should not see this dialog.
Down in your windows system tray, there should be an IIS Express icon that looks like (or is supposed to look like) a stack of rack servers. Right click that icon and click "Show All Applications". You should see that the UCosmic.Www.Mvc app is running over HTTP on port 1976, and over HTTPS on port 44376. To view the application home page, click the https://localhost:44376/ link. This will open the UCosmic home page in your default web browser.
<< Back: Before you open the solution | Next: Advanced IIS Express SSL & host name setup >>