Randomly would get this error and dialog when loading and running a new or existing Visual Studio Web project on a machine that never had run it before. The problem seems to have various solutions to it with varying results. Below is the solution that ultimately worked in my situation with the Event Log error I was getting.
First open up the Event Viewer in "Windows Administrative Tools" under the start menu. If you find the following error:
Unable to bind to the underlying transport for [::]:XXXXX. The IP Listen-Only list may contain a reference to an interface which may not exist on this machine. The data field contains the error number.
Where XXXX is a port number for the website that is failing to run in Visual Studio.
If this is the case you can run the following command in an elevated PowerShell / command prompt
netsh http add iplisten ipaddress=::
Then reboot the machine and try again
So I was going through the tutorial Handling Concurrency with the Entity Framework in an ASP.NET MVC Application when I encountered this error on step 7 of 10.
Type 'ContosoUniversity.DAL.Department' could not be found. Make sure that the required schemas are loaded and that the namespaces are imported correctly. Near type name, line 1, column 132.
The error is thrown on the following line:
var databaseValues = (Department)entry.GetDatabaseValues().ToObject();
This error is due to a bug in EF 4.1 where you separate the DAL and Model Entities out into different namespaces and is referenced here EF4.1 CodeFirst - entry.GetDatabaseValues() throw EntitySqlException.
To fix this issue I came up with this workaround:
Replace the lines:
var databaseValues = (Department)entry.GetDatabaseValues().ToObject();
var clientValues = (Department)entry.Entity;
with the following lines:
var clientValues = (Department)entry.CurrentValues.Clone().ToObject();
entry.Reload();
var databaseValues = (Department)entry.CurrentValues.ToObject();
It seems to work ok for simple concurrency checks and it allows you to continue on with the tutorial.
In some cases there is an issue with installing the following update “Security Update for Microsoft Visual Studio 2008 Service Pack 1 (KB971092)”. The workaround to properly install the update you must set the security on the files vsvars32.bat and vcvarsall.bat to allow the local Users group write permission on those files. I am not sure why this is an issue but from reading other posts and such on the issue most of the affected people do not have vc++ installed.
They can be found in the following folders:
x86
x64
When developing using Visual Studio (VS) Microsoft recomends that you run VS with elevated permissions for debugging, for the most cases you really don’t need to do this but if you want to make it easier on yourself you can force VS to elevated permissions on the shortcut. Just right click on the shortcut and select Properties from the context menu then select the Compatibility Tab and check off the Run As Administrator check box as seen below. Now you probably want to turn off the UAC feature with this as well, this guide shows a few ways to do this.
That’s it.