All posts by Emil

ASP.NET MVC4 site gives Error 403.14 on IIS 8.5

Publishig a new project created with Visual Studio 2013 Update 3 and ASP.NET MVC4 on IIS 8.5 and Windows Server 2012 R2 only resulted in Error 403.14.

Since it was the first MVC project on that server I thought is was a configuration issue in IIS. After testing almost all suggestions found on Internet (most of the referring to IIS 7.5), I found someone with that same problem and had a solution.

The problem was the setting “Precompile during publish” when publishing. I publish to a local folder before sending it to the server and I’d selected that because I thought it would make the site faster. But this completely broke the site!

Disabling “Precompile during publish”, republishing it (locally) and sending it to the server and now it worked as expected!

.NET Collections: Comparing Performance and Memory Usage

I develop several web sites with dictionary search engines where you can search for words in a lots of different ways. Because of the flexible searches with regular expressions, normal indexes in databases engines are almost useless.

The current solution is to load all objects into memory. The search data is fairly static and  does not grow much, so it works quite well. The current solution finds the results most of the time in a few hundreds milliseconds (0.001 to 0.5 seconds).

Recently I have been looking at the graph database Neo4j, but because of the kind of searches that are done on the pages the results on test data was incredibly poor. Most queries took 2 to 9 seconds and that was on test data that was only a small part of the real data and only 5% of the relations was generated. I might give it another try with real data when Neo4j 2.0 is released as stable, but I don’t think I will perform well with this special case.

So the next step is to do some memory indexing on my own. The first question was to find out which of the collections in .NET is the fastest and which uses the least memory.

The tests were all done on my laptop with as few programs running as possible. This would make the results fairly reliable, but I can’t guarantee that the results are fully correct. But I trust them and will base my future development upon them. 

The time column shows the total time of a fixed number of lookups.

One string stored 10 million times with <int> Key

This test stores the same string in all the records in the collection. Because of this the difference in size should only reflect the key index.

Size (MB) Time (ms)
Dictionary<int, string> 267 235
SortedDictionary<int, string> 534 4484
Hashtable 547 1851
SortedList<int, string> 114 2156

chart_1

10 million unique strings stored with <int> Key

This test stores different strings in all the records in the collections. This will create a more realistic test of the memory usage.

Size (MB) Time (ms)
Dictionary<int, string> 706 368
SortedDictionary<int, string> 973 4590
Hashtable 985 2286
SortedList<int, string> 553 2122

chart_2

10 million unique strings stored with <string> Key

If I could have strings as keys I would be able to use the collections in more ways than one. But as you can see some of the lookups became more than 10 times slower than in the tests above.

Size (MB) Time (ms)
Dictionary<int, string> 706 1957
SortedDictionary<int, string> 973 66057
Hashtable 757 2950
SortedList<int, string> 591 74534

chart_3

1 million sub-collections with 10 strings each with <int> Key

This was another test I did to see if it would be useful to store the data in a tree, so each records in the collection holds another collection. This is a special case for my needs and I don’t expect anyone else to have any use of it. But I did the test, so I give you the numbers.

Size (MB) Time (ms)
Dictionary<int, string> 431 273
SortedDictionary<int, string> 656 801
Hashtable 733 1634
SortedList<int, string> 245 618

chart_4

 

Conclusion

The collection with the best performance is Dictionary<> and the collection with most compact footprint in SortedList<>.

The most surprising to me was that the SortedDictionary<> performed so badly.

References

In an earlier post i linked to this blog that has a great post about performance of the different collections. It has a nice list with all the different collections, but does not talk anything about the memory usage.

http://geekswithblogs.net/BlackRabbitCoder/archive/2011/06/16/c.net-fundamentals-choosing-the-right-collection-class.aspx

Error number: 0x8024D001 in Windows Update on Windows XP Professional SP3

Yesterday I did a clean install of Windows XP Professional SP3 on a virtual machine for testing. First thing after installing is running Windows Update.

But the Windows Update web page did not load properly and only showed the error “The website has encountered a problem and cannot display the page you are trying to view. The options provided below might help you solve the problem.”. Of course, none of the options provided did say anything about this problem. The only help was an error code “Error number: 0x8024D001” up in the right corner of the page.

 

To solve this I had to make Windows XP download and install the first updates without using the web page, by installing it from the notification area.

Fist I had to make sure Windows Update was set to check for new updates automatically. This is selected in Automatic Updates in Control Panel.

To get Windows Update to check for updates quicker i started a command prompt and typed:

C:>wuauclt /detectnow

That made the notification balloon with “Updates are ready for your computer.” popup after less than a minute. This made it possible to install the first update without using the web page.

 

When that was done, and the computer was rebooted once (or twice) the Windows Update web page worked again. And then that Windows Update wanted to install the “Windows Genuine Advantage Validation Tool” (which for some reason took several minutes to find), and after that there was the rest of the 123 updates…

Service VMware Authorization Service (VMAuthdService) failed to start

When installing VMware.

You will get the error “Service VMware Authorization Service (VMAuthdService) failed to start.” when installing VMware (I’ve tried Player and Workstation) and have Avast installed.

Disabling Avast will not do any difference. Uninstalling Avast will work, but there is an easier solution.

 

In Avast click Settings and then Troubleshooting. There uncheck “Enable hardware-assisted virtualization”. After that you have to reboot your computer.

 

Remote Debugging ASP.NET Development Server with SPI Port Forward

If you try to connect to the ASP.NET Development Server included in Visual Studio from another computer, you simply just can’t.

It’s a safety feature from the Visual Studio team, but also a big headache for many developers. If you want to test a PDA connecting to a web service on ASP.NET Development Server it is not even possible to run the test software locally on the same computer as the server.

After searching the web I found this question (and solution) on stackoverflow: http://stackoverflow.com/questions/1730280/accessing-asp-net-development-server-from-another-pc-on-the-network.

But since the answer on stackoverflow is linking to download.com, downloading the SPI Port Forward program is another headache. After the download the file is well hidden in some temp folder far away. So I added a download here.

Download SPI Port Forward here

After starting the program. You enter the port number you want to remote connect to your local ASP.NET Development Server with in Local port. Enter localhost as Remote host. And enter the port that the ASP.NET Development Server is using as Remote port. Then Activate to enable the port forward.

Now you can connect to your local ASP.NET Development Server by connecting to: 192.168.1.15:12345. Where 192.168.1.15 is your local computer (with server) IP. And 12345 is the port you entered in Local port.