Archive for March, 2015

SQL Server error: Login failed for user ‘user’

While creating a new .NET application, I tried to load the login page and saw this error waiting for me in the Event Viewer:

Login failed for user ‘scott’. Reason: Failed to open the explicitly specified database ‘Test1’

This error had a code of 18456, if you are keeping score at home.

Short story even shorter, I had the wrong name in the web.config connection string that pointed to the database. As you can see in the error, the database named was “Test1”. In the connection string, I had it named “Testv1”.

 

Advertisements

Leave a comment

“Package restore is disabled by default” in Visual Studio

While opening a solution that another developer (or ten) had worked on earlier, I came across this friendly NuGet error:

Package restore is disabled by default. To give consent, open the Visual Studio Options dialog, click on Package Manager node and check ‘Allow NuGet to download missing packages during build.’ You can also give consent by setting the environment variable ‘EnableNuGetPackageRestore’ to ‘true’.

As I delved into Tools -> Options – Package Manager to set the required setting, I saw that it was already set.

After some StackOverflowing, I saw that a workaround for this was to set an environment variable. To do this in Windows 8, I went to Control Panel – System – Advanced and clicked on the “Environment Variables” button. I added a new system variable called “EnableNuGetPackageRestore”, and set its value to “true”.

After doing this, it still didn’t work. I found that I needed to close and reopen Visual Studio in order for the change to take effect.

Leave a comment

Finding Silverlight configuration files

I was working with Silverlight application that had some a couple of configuration files. When starting up my application, I got a relatively helpful error message that pointed to the missing configuration file, which was http://localhost:2784/Config/cool_config.xml

I’m always pleasantly surprised when I get a helpful error message when developing.

However, there was no such directory. So where was my missing file?

If you pull up the ASP.NET Development Server window that starts when you are debugging an web-based application, you will see a window similar to this:

Development Server

Development Server

 

The “Physical Path” field contains the location of the application. From that base directory, I was able to find where my configuration file should have been and put it there.

Leave a comment