Great Presentation by Scott Hanselman
I have documented the key learning for my future reference.
Highlights of the show:
www.nuget.org – package management site
http://stats.nuget.org – shows you the stats
installing elmah using nuget
elmah – error logging modules and handlers. nuget makes installing elmah easy.
mvchtml5templates – package for html5 templates. Editor templates override datatypes
If the browser does not support datetime, then use the jquery ui to make it support datetime.
refer jquery.ui.all.css to format the datetime popup
CodeFirst
EntiryFramework supports ModelFirst, DatabaseFirst and CodeFirst
C# Class Diagram lets you visualize the code
IIS Express
Limitations of the Web server that comes with Visual Studio:
- no SSL support
- no port 80
- hard to get WCF working
- doesn’t feel like IIS because it is not IIS
Solution: use IIS express
IIS Express resides in the user My Document directory and it runs on Win XP and actually is IIS 7.5
How do you make your application run on port 80 with IIS Express?
In the past one port was handled by one process, when a request was received the the process with the port will process the request. Now ports are reserved by http.sys which listens on port 80. http.sys hands the request off to your process. The permits multiple processes to listen on one port. However, the port needs to be reserved. Use netsh command as follows:
for port 443:
netsh https add urlacl url=http://hanselman-w500:443/ user=everyone
use the netsh firewall command above to open port 80 on IISExpressWeb.
Add port 80 to the applicationhost.config file
Run the application
That’s great, but how do you configure https Port 443 for your Account Page.
Use the re-write rule in the system.web section of the web.config file to redirect to https port.
Great, but this will not yet work because we don’t have a certificate yet.
To create an SSL certificate:
Certificate is created
Copy the GUID of the certificate
run the command to add the ssl cert
add https to the applicationhost.config file
Now, when you run the application and go to the Accounts, it will warn you about a non-registered cert.
To register the cert, move the cert to “Trusted Root Certificate”
and voila!
Another easier way
is to set SSL Enabled property to true
WebMatrix makes adding SSL certs (https) extremely easy. WebMatrix gives you a self-signed cert for free.
Glimpse
Gives you a glimpse of what's going on in your app. Think of it as a Firebox for your MVC. Glimpse installs you using nuget.
Enable Glimpse for your app:
Tracing become so much easier