Monday, June 21, 2010

Error 500 after installing SharePoint 2010 and Visual Studio 2010

Hi all,

Just and update on some frustrating behaviour I recently had.
The solution is so simple it's annoying to let anyone else struggle with it...

Well, I went ahead and installed SharePoint 2010 on my Win7 64 bit laptop.
In stand alone mode, everything was going great!
here is a link to a great step by step guide for doing that: http://msdn.microsoft.com/en-us/library/ee554869.aspx

OK, once I was done - SharePoint was working great and at lightning fast speed!

Next I wanted to install Visual Studio 2010 on that same machine, so I ran the installer and chose to install C#, Web developer and among other things the SQL express that comes with it.

Installation, again, was going smoothly.

After a reboot - I noticed that SharePoint had stopped working, and any page I tried to access gave me server error 500... even the central administration!

Naturally, I ran the SharePoint configuration wizard and hoped it will make everything better again... only to find out it reports that my configuration database is not available!

So, first step was to fix the DB not available thing... that was easy:
apparently installing VS with its SQL express had stopped the SharePoint SQL instance and all I had to do was to start it, using services or using the start menu -> "SQL Server Configuration Manager":


OK - that allowed me to complete the SharePoint configuration wizard, but did not resolve the server error 500 I keep getting hitting any SharePoint page.

SharePoint log files were useless, which means that the error came before SharePoint code was even called.

Windows log viewer was very helpful on this, reporting an ISAPI filter that could not be loaded and caused the site load to abort: "Could not load all ISAPI filters for site/service. Therefore startup aborted"
Followed by another message:
"ISAPI Filter ‘C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_filter.dll’ could not be loaded due to a configuration problem. The current configuration only supports loading images built for a AMD64 processor architecture. The data field contains the error number. To learn more about this issue, including how to troubleshooting this kind of processor architecture mismatch error, see http://go.microsoft.com/fwlink/?LinkId=29349."

After a little trial and error, I have noticed that the ISAPI filter DLL file is being loaded from the 32 bit framework folder. Changing that manually to 64 bit in all my sites solved the problem!
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet_filter.dll

So, while I am not sure of why this is happening, but at least here is how to fix it!

Wednesday, June 16, 2010

Running 64bit VM on Win7

With the SharePoint 2010 released, we are all bounded to work on 64bit OS's, and my choice is still to virtualize since I can abuse the system as much as I want and revert back to original in seconds.

So, the problem is that the best performance we've got is when running win2k8r2 64 bit host and using hyperv to run win2k8r2 64 bit VM on it.

Works like a charm on my PC, but what happens when I want to have that VM accessible on my laptop? I do like my win7 there, and don't want to install win2k8 since it is a multi touch tablet which many things are not supported with a server OS.

Well, the options are to either use the boot from VHD option, which in my case was a pain since I had the VM created in and for hyperv.

The Other option I found was to install VirtualBox(.org) which let me run 64 bit VMs on my windows 7.

It also runs VHDs, most if not all - just straight out of the box.

I hit a problem with the latest one that when I booted a VHD created in hyperv into my VirtualBox it would boot into a blue screen every time.

The solution was amazingly simple though, glad I thought of it and didn't give up: See, when creating a new VM in VirtualBox, the VHD is added through a SATA controller. All I did was to remove it and add the same VHD using an IDE controller and boom! It worked!

(this was after a lot of trial and error of course... :)

Well, if you run into a blue screen in VirtualBox - Be sure to try and change the HDD controller!

good luck!

Tuesday, June 1, 2010

Sandbox solutions - Good or Bad?

Hey,

I have seen a lot of guys talking about sandboxing in SharePoint - if its a good thing or a bad thing to do.
I just thought I add my two cents as most of what I think about that subject was not covered by any of these posts... So I am beginning to think I'm a lone wolf.

Good

When are sandbox solutions actually are useful
The main benefit of sandboxing a solution as I see it is either when you wish to pilot a custom solution or a product for a trial period (and afraid it will have a bad impact on your farm), or when you wish to deploy a solution that was built for 1 department, and only they will use it within 1 site collection.
Sandbox allows your site owners to basically upload custom built code and run it off your server.
Scary, eh? I agree.
This is why Microsoft has limited the things and resources you can access within your sandbox solution. Otherwise, it would have been a security breach and no one would have use it - so please, stop complaining about the limitations that comes with it! So, to sum it up:
- Limited access, more secure
- Deployed using a browser, no need to access server
- Has no effect outside current site collection, safer to test / pilot anything risk free
- Easy to monitor

Bad

When sandboxing is not good for you
Overusing sandboxing is not that good, or may not be good for everyone. See, because of the optional security risk involved with sandboxing, Microsoft had to apply some restrictions on these solutions. As a part of the solution for this risk, a sandboxed environment is created for each instance of the solution that is deployed. This environment includes separate storage of the solution files, separate process that runs its code and separate memory to go with it. Imagine you have 400 sandboxed solutions, or just one that is deployed in 400 site collections - clearly this would be a huge waste of resources. Another good/bad thing (you decide) is that once you want to upgrade a sandbox solution that was deployed in 400 site collections - you need to do it manually one by one (or powershell it). Some consider this good as it allows you to test the new version before you deploy it everywhere. I consider it bad since even if you deploy it in full trust you can still pilot the new version as sandbox solution, right? :). I am ignoring of course of the limitations in sandbox solutions that might prevent you completely from using them, which are well covered in other blogs including how to overcome most of them using proxies, or storing resources in an assets library etc... So, to sum it up:
- Waste of resources
- Requires stronger servers or dedicated server to get same performance as full trust
- Hard to manage / upgrade

Ugly

When are sandbox solutions cross the line and start being just stupid
Some of the things in sandboxed solutions are just plain stupid, and do not make sense in security considerations for me at least. Like, say you deployed a sandboxed web part and added it to your page - you tested it and saw it is working OK. After a week of testing you retract the solution and deploy it as full trust. The dll is the same, the web part is the same, but it will no longer work on pages you added it before! you have to remove it and re-add it... Another thing that I cannot explain is why Page.ClientScript.Register**** methods do not work. As soon as I deploy as full trust the same code works like a charm. What is the security risk in using this API I wonder... I can just use the render method to write the same HTML to the page after all, no? Last, as I understand why sandbox solutions cannot access the hive folders, I do not understand why Microsoft did not implement some sort of virtual folders that allows you at least add resources and ASCX files for use withing your solution. So to sum it up:
- Have to remove, re-add and re-configure web parts when switching between deployment methods of same solution
- Cannot use Page.ClientScript to register scripts
- Cannot add resources in a simple way that will be the same regardless to which deployment method my customer chooses.

Please feel free to comment and give your input on this, I will try to update if and when I have more to say on the subject.