25 minute Windows 8 guide for all skill levels

2013/05/18

I’ve had windows 8 at home for a while and have been really frustrated with it. This video is a face-palm moment -  “Why didn’t I google for this before”. See here



Installing IIS On Windows Server 2008 R2

2013/05/11

After installing Windows Server 2008 R2, you may be scratching your head trying to work out where Internet Information Services (IIS) is. Well, it’s not installed by default, so the natural thing would be to go to the traditional ‘add/remove windows features” dialog. However, things have changed in Windows Server 2008 R2! – You start the process by adding a role to the server.

See this link for more information.

http://technet.microsoft.com/en-us/library/cc771209.aspx


Windows Server 2008 “Your current security settings do not allow this file to be downloaded”

2013/05/08

Occasionally I have to install a Web server or SQL Server on a fresh Windows Server 2008 R2 operating system, and by far the most annoying bit about it is just getting windows updates and the downloads you need onto the machine. Here’s a reminder (more for myself) how to quickly enable Internet Explorer 9 to act normally, even if it’s just temporarily.

There are a few options to get the job done.

Option 1 Add the site to your trusted sites

When you try and click a link, you’ll probably see this dialog.

NotAllowedToDownloadButCanAddToTrustedSite

You can simply add the current site to the trusted sites list by the Add… button.

This has the same effect as enabling file downloads manually (Option 2) but will also allow much more than just file downloads to take place, so only use this if you really do trust the site.

Option 2 Enable file downloads for the internet zone

  1. Open Internet Explorer.
  2. Click the  Cog icon and then click on Internet Options
  3. Click on the Security tab
  4. Select the Internet Zone.
  5. Click on the Custom Level… button
  6. Scroll to the Download section.
  7. Enable File download.
  8. Click OK and .
  9. Restart Internet Explorer.

SecurityTabFileDownloadOption

Option 3 Use another computer to get the downloads (recommended for maximum security)

  1. Use whatever mechanism you can to transfer the files (USB, File share, FTP, DVD, ISO mount, the list goes on….)

Option 4 Install Google Chrome

  1. Yep, them pesky settings only apply to IE!

Option 5 Disable Protection (probably the worst idea and might not help at all)

Because there are many ways in which you can have a file sent to you (not just by clicking a direct link) you may find that the only way to get the download started (other than trusting the site), is to disable protection. I’ve not encountered a situation yet where this has helped, but I’ve not tried hard enough. I’ve seen this suggested on other forums so thought I’d better include it. But see the link at point 3, this option opens up a whole can of worms. If in doubt, choose option 3!

  1. Click the Cog icon, and select Internet Options
  2. Go to the Security tab
  3. Uncheck the Enable protected mode tick box. Want to know what it really does? See here.
  4. OK the Internet Options page and Restart IE

You will now be nagged about not being protected any more. Try not to catch a cold. If you love screen shots, see this guide.

WarningForProtection


What does .mdf file contain in an asp.net project?

2013/05/06

(For Visual Studio 2012, ASP.NET 4) The .MDF file in an ASP.NET project is quite simply a SQL Server 2012 database file which supports the MVC application. The Model classes define the structure of the database using the Code First methodology. By default, in Visual Studio 2012 when you create an MVC application it will use the LocalDB engine to access the database, in earlier versions of Visual Studio the SQL Server Express engine was used. Once generated you can view the structure of the database within visual studio, or attach the .mdf file to a SQL Server instance and view it with SQL Server Management Studio.
See the official asp.net site for some fantastic tutorials and videos.


Error message: System.Data.Entity.EdmEntityType: EntityType ‘blah’ has no key defined. Define the key for this EntityType

2013/05/05

You may see this error message when adding a controller.

You may see this error message when adding a controller.

If you’re trying to code an MVC app, you may see the following message appear when adding a controller class. There are a number of fixes for this on stack exchange and the internet, but yet again, I am special. I found another way in which you can get this error message.

Here’s my very simple model and context code which caused the error.

   1:  namespace TestMVC.Models
   2:  {
   3:      public class ItemContext : DbContext
   4:      {
   5:          public ItemContext()
   6:              : base("DefaultConnection")
   7:          {
   8:          }
   9:   
  10:          public DbSet<Item> Items { get; set; }
  11:      }
  12:   
  13:      public class Item
  14:      {
  15:          public int ItemId;
  16:          public string ItemName;
  17:      }
  18:  }

According to the multitude of stack-overflow answers like this one, all one needs to do is add the [Key] attribute before your ID member, and remember to include the System.ComponentModel.DataAnnotations namespace.

However, the conventions for code first development are at odds with my code, I shouldn’t need the [Key] attribute.

The actual answer to my particular problem, was that Visual Studio requires getters and setters on my ItemId. That simple. Here’s the fixed model class.

   1:  public class Item
   2:  {
   3:     public int ItemId {get;set;}
   4:     public string ItemName {get;set;}
   5:  }

Please let me know if this helped you, or if I’m missing something!


Allowing remote access to your IIS Express service

2013/04/21

While developing an ASP.NET application with the IISExpress service, you might like to see how it looks on your mobile device connected to your LAN via Wi-Fi, or just any computer connected to your network.

If you do not happen to have the full IIS installed already, you can allow your IISExpress service to serve remote pages quickly and easily by following these steps.

Warning: By following these instructions you are solely liable for any security breach or problems you may face. Do not use this information if you do not agree with that statement.

Assume your machine name is ‘jedi’, and your port number is ’16253′, replace appropriately.

1. Run a command prompt as administrator, and type in

netsh http add urlacl url=http://jedi:16253/ user=everyone

2. Open up the following file in Notepad or Visual Studio

MyDocuments\IISExpress\config\ applicationhost.config

change the binding from:

<binding protocol="http" bindingInformation="*:16253:localhost" />

to:

<binding protocol="http" bindingInformation="*:16253:jedi" />

3. Restart the IISExpress service (use the tray icon or task manager).

4. In Visual Studio, change your Project->Properties->Web settings to launch http://jedi:16253 insead of http://localhost:16253

5. In a web browser on your development machine type http://jedi:16253/

6. Assuming all is good – Open up the port on the firewall.

        • Goto the Windows Firewall with Advanced Security panel
        • Create a new inbound rule
        • Click ‘Port’
        • Click ‘Next’
        • Click TCP
        • Enter a specific port 16253
        • Click ‘Next’
        • Click ‘Allow the connection’
        • Click ‘Next’
        • Click ‘Next’ (you could untick Public)
        • Give it a name “My MVC App” and press Finish.

7. You should now be able to access the page on the mobile device when connected to the Wi-Fi using http://jedi:16253/

For more advanced information see Scott Hansleman’s blog post.


Follow

Get every new post delivered to your Inbox.

Join 65 other followers

%d bloggers like this: