Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I developed a custom ASP.NET application where I retrieve/update list and document library items using REST. It works perfectly fine locally but when I deploy it to a web server it doesn't work the same. Once it's deployed to the web server I'm able to retrieve list and document library items but I'm unable to update the document library items. Though I can still update the list items.

I get a very generic error messages and there isn't anything in the log files for the web server or SharePoint servers. This is the error:

Exception Details: System.Data.Services.Client.DataServiceClientException: 
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<error xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
<code></code>
<message xml:lang="en-US">An error occurred while processing this request.</message>
</error>

Why does everything work fine locally but when I deploy it to a web server the REST update doesn't happen on the document library? Anyone else experience this issue?

share|improve this question
    
do the sharepoint event log or windows event log have any information regarding the error in them? –  Colin Jun 24 '11 at 17:10
    
The only error that's logged is the exception I had in my original post. This is logged on the event viewer on the web server doing the update. There is nothing in SharePoint logs. –  davidevan Jun 24 '11 at 17:16
    
Could this be an authentication issue? Did you build / test the code on a single machine and are you now trying it from 1 machine to another? SharePoint can be pretty "particular" about POST / PUT requests –  Colin Jun 24 '11 at 17:43
    
I built and tested the code on a different machine than SharePoint. It only seems to work fine when I run the application in Visual Studio (debugging mode). Once it's deployed to a web server it doesn't update document library items. I even changed the application pool to run under my own indetity (same as when I run it in Visual Studio) and I'm still experiencing the issue. –  davidevan Jun 24 '11 at 18:48
    
Scratch my most answer then :-D. Could you try to add the code from answer if you haven't done so already yourself? Can you enable fiddler to see what requests / responses are being sent? –  Colin Jun 24 '11 at 19:04
show 1 more comment

1 Answer

Code running on the same machine is very difficult to test because of the fact there are no security boundaries, i.e. different machines. My money is on a security issue. Never used REST to talk to a service before, but for consuming services running under sharepoint tyou need to pass credentials and set the impersonation level:

client.Endpoint.Address = new EndpointAddress("serviceurl");
client.ClientCredentials.Windows.AllowedImpersonationLevel = TokenImpersonationLevel.Impersonation;

Then, seeing as this is an ASP.NET app, the app pool account of your ASP.NET app needs to have read access to sharepoint. If it is running under one of the default system accounts (ASPNET or NetworkService), change the app pool identity to a domain account, give that "logon as service" and "logon as batch" permissions (either through local security policy on the server it runs on itself or through domain policies).

Then give the app pool account read access to the sharepoint web app (easiest is through central admin -> web app -> user policy)

share|improve this answer
    
I changed the application pool of my ASP.NET app to run under myself. I'm a farm administrator and I still have the same problem with updating the document library item from a web server. As I mentioned the SharePoint environment is not on the same machine where I did my development. Though it works perfectly fine when I update document library items from my devlopment machine. As soon as I deploy it out to the web server I experience problems updating a document library using REST. Perhaps I'm missing a hotfix or update on the web server that I have locally? –  davidevan Jun 28 '11 at 15:10
    
Being a farm admin doesn;t make you a site collection admin. They are very much separated. But this does sound very weird though.... –  Colin Jun 28 '11 at 19:32
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.