Monday, December 16, 2013

Platform Not supported Exception when running Visual Studio Web Application

Hi All,

While i was developing a web application that creates an instance of a custom service application using Visual Studio 2013, I was getting this error:

Exception Type: PlatformNotSupportedException

Details:

Microsoft SharePoint is not supported in 32-bit process. Please verify that you are running in a 64-bit executable.


I have another SharePoint web part project that connects with no issues to the SharePoint custom service app, but this web application is throwing this exception! so, the error is related to the IIS express which is the default IIS for VS 2013 web projects.

The error will exist or be thrown when you create any SharePoint object such as: SPSite to connect and then implement your logic.

I googled little bit and i found that some blogs were saying to un check the prefer 23 bit under Build tab in the project properties, In my case this check is grayed out so i don't have the option to un check it.

In addition to that, by default all SharePoint projects or Web Projects are targeting AnyCPU, so you shouldn't change this specially if you are connecting or integrating with SharePoint.


The fix:
1) Right click on the web project that you are having this error and click on the web tab.
2) Under Servers, change the selection from IIS express to Local IIS, This will use the local IIS instance which is a 64 bit installation of your SharePoint Development machine.
- Note: This will allow VS 2013 to create a virtual directory and attach the process, so you will be able to debug once you hit F5.
3) Run you project, the code works with no exception when creating any SharePoint object such as a Site or Web...etc.

SharePoint Development Machine Configuration: Win Server 2008 R2 64 bit, VS 2013 latest release.

Happy SharePointg!!

Tuesday, December 03, 2013

Sorry, Something went wrong when deploying WCF service in SharePoint 2013

Hi,

While i was developing a RESTful WCF Service that is targeting SharePoint 2013 using VS 2013, I was getting the following "White" error page when i access the WCF service after deploying my project in VS 2013.




As shows in the above screen shot, The error is related to getting and loading the right assembly for my WCF service class type, I know the GUID in my WCF class is matching the GUID in the svc file. But what is the problem ?

I found out that the solution for this problem is SharePoint doesn't accept the upper case letters in the GUID.

This was my GUID:  CDCC536B-37BB-4CC3-BF20-263AB66926D5

I changed the GUID by replacing the upper case characters to lower case characters in the Service class and in the SVC file, then save and deploy! It works!

Happy SharePointing!


Sunday, December 01, 2013

HTTP 500 error when you login in Joomla as an administrator

Hi All,

I was trying to install and configure one of the most popular open source CMS Joomla 3.2. After i installed and configured my first site, I was getting HTTP 500 error when i log in as administrator from the site.

I checked and i found that the super user is created in the database and the username/password has permissions to access the created DB for the site but i can not log in to the CMS site as a super user or administrator!

I check the configuration.php and web.config and i found the following http handlers has been added in the web.config file by IIS.

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <directoryBrowse enabled="true" />
        <handlers accessPolicy="Read, Execute, Script">
            <remove name="PHP55_via_FastCGI" />
            <add name="PHP55_via_FastCGI" path="*.php" verb="GET,HEAD,POST" modules="FastCgiModule" scriptProcessor="C:\Program Files (x86)\PHP\v5.5\php-cgi.exe" resourceType="Either" requireAccess="Script" />
        </handlers>
    </system.webServer>
</configuration>


I have installed and configured PHP 5.5 using IIS 7.5 in Windows 8 but i do not know why the IIS has added the highlighted entries in the web.config.

The fix, is to remove the PHP http handlers from the web.config and the log in will start working like a charm !

Hope this helps.
- ME