01 diciembre 2008

Troubleshooting Excel Services

I got an "Access denied. You do not have permission to perform this action
or access this resource" while trying to render an Excel in Web Browser
mode. After one hour carefully examining logs I found the problem. The
Shared Services Application Pool was configured with anonymous
authentication in IIS, which lead to an authentication problem.

Excel Services logs, at 12 hive showed the authentication problem:
ExcelService.ProcessRequestIdentity: IIS didn't pass us an authenticated
user, Check that the virtual folder is set to authenticate using
WindowsIntegrated
A user attempted to access Excel Services, but was denied because they do
not have a domain or local machine identity. [User: ]
Access denied. You do not have permission to perform this action or access
this resource. At (..)

IIS logs showed no user was passed to application:
2008-12-01 17:50:24 W3SVC1720207907 VMSHPP 127.0.0.1 POST
/SharedServices1/ExcelCalculationServer/ExcelService.asmx - 56737
VMSHPP\Administrator 127.0.0.1 HTTP/1.1
Mozilla/4.0+(compatible;+MSIE+6.0;+MS+Web+Services+Client+Protocol+2.0.50727
.3053) - - vmshpp:56737 200 0 0 27634 1207 78

Hope this helps...

14 noviembre 2008

Tunning a development virtual machine for Sharepoint

One of the rules I have set up in my team when developing Sharepoint
projects is to use Virtual Machines. We may use VMWare or Virtual PC,
depending on the machine pattern we take at the beginning of the project.
Though our hardware is usually a high-profiled Dell laptop, it sometimes
becomes a quite slow environment to work.

Four tips to run Sharepoint virtual machines faster I have found so far are:
- Running the machine in an external disk.
- Assigning at least 2 Gb of RAM Memory.
- Stoping search service (when not needed).
- Defragmenting the virtual machine. If you use VMWare you can do it from
the disk tools, in machine settings, which is much more faster.

Hope this helps to anyone working in a similar way...

07 noviembre 2008

Troubleshooting Excel Web Service and Visual Studio 2008

After some hours developing with Excel Web Service and Visual Studio 2008 I have discovered that an only single consideration can save you a lot of time.

When you add the Excel Web Service in Visual Studio 2008 operations will have a different signature compared to MSDN samples, and if you try for example to set a range you may experience some problems with an object of type ArrayOfAnyType.

However all these issues and differences can be avoided with one simple configuration change:

1. Add the Excel Web Service.

2. Click the Visual Studio button to Show All Files, in Solution Explorer.

3. The Web Service will appear as a folder. You can click on it and some files appear.

4. You will see a file called Reference.svcmap. Open it.

5. In element: ReferenceGroup

a. In ClientOptions

i. In Serializer: Change Auto to XmlSerializer:
<Serializer>XmlSerializer</Serializer>

And everything will work fine!

In the link below there is a comment that explains what we have done. By default Visual Studio uses a DataContractSerializer, but an XmlSerializer should be used instead.

http://social.msdn.microsoft.com/Forums/en-US/sharepointexcel/thread/2fd36e6b-5fa7-47a4-9d79-b11493d18107/

The requested range is not a valid sheet location

I tried the example in MSDN for setting a range of an Excel by using the Excel Web Service. A simplified way of this example is calling the web service in this way:

object[] o1 = new object[1];

object[] o2 = new object[1];

o1[0] = 1;

o2[1] = o1;

excel.SetRangeA1(sessionId, "Hoja1", "c2:c2", o1);

Notice that the last parameter must be an array with an array in each position (a jagged array).

If you add a reference in Visual Studio 2008 this does not work as the last parameter must be of type of ArrayOfAnyType. If you try the following:

ArrayOfAnyType aoat = new ArrayOfAnyType();

aoat.Add(1); // we add an object

excel.SetRangeA1(sessionId, "Hoja1", "c2:c2", aoat);object[] o1 = new object[1];

This will generate an exception: The requested range is not a valid sheet location. The solution is it needs the second dimension:

ArrayOfAnyType aoat = new ArrayOfAnyType();

ArrayOfAnyType aoat2 = new ArrayOfAnyType();

aoat2.Add(1);

aoat.Add(aoat2);

excel.SetRangeA1(sessionId, "Hoja1", "c2:c2", aoat);

This code will work fine.

10 julio 2008

Growing in IT world

After many time blogging about Microsoft technology I have a frustration: I have only captured the attention of the blogsphere in career related postings!

Maybe I should only post my thougts about something that really pationates me: how can I be a better IT professional tomorrow?