I have a class which consumes the dfs service. The class is tested in Windows Console application which can get the result. When I copy the same code and called it from web page in a web application, it stops working. The error message is :Failed with exception Service method "Get" invocation failed.
The class is very simple, to get the content url given objectIdentity, etc.
Public Function GetContentUrl(ByVal objectIdentity As ObjectIdentity, ByVal geoLoc As [String], ByVal transferMode As ContentTransferMode) As String
Dim transferProfile As New ContentTransferProfile()
transferProfile.Geolocation = geoLoc
transferProfile.TransferMode = transferMode
DemoServiceContext.SetProfile(transferProfile)
Dim contentProfile As New ContentProfile()
contentProfile.FormatFilter = FormatFilter.ANY
Dim operationOptions As New OperationOptions()
operationOptions.ContentProfile = contentProfile
operationOptions.SetProfile(contentProfile)
Dim objectIdSet As New ObjectIdentitySet()
Dim objIdList As List(Of ObjectIdentity) = objectIdSet.Identities
objIdList.Add(objectIdentity)
Dim dataPackage As DataPackage = objectService.[Get](objectIdSet, operationOptions)
Dim url As UrlContent = dataPackage.DataObjects(0).Contents(0)
Return url.Url
End Function