This project has moved. For the latest updates, please go here.

Custom Param in WebService

Nov 17, 2008 at 1:48 AM
Edited Nov 17, 2008 at 1:48 AM
Hi Michel,

sorry for the stupid question: how to access the customparam value within the webservice?
I'm trying to pass an argument to insert some metadata into a db.

Thx!
Marcus.
Coordinator
Nov 17, 2008 at 7:15 AM
You can override the FinishedFileUpload(string fileName, string parameters) method. The parameters parm here is the same as the value of CustomParam.

Make sure you didn't rename CustomParam in the Silverlight InitParameters. It should be named CustomParam.
Nov 21, 2008 at 1:37 AM
Hi Michel,
thx - that worked out perfectly.

One follow up, if I may: is there any way to diagnose upload errors?
Everything worked fine on my notebook (VS2008), but it's giving me Upload failed errors on my webserver.

Am I correct in the assupmtion that the upload happens in the Application Pool user context?
Is there anyway to turn on verbose logging or somthing like that?

The only thing I can see is in my IIS logs giving me a 404 Error on "POST /SilverlightUploadService.svc", which doesn't make sense. The file is there ...

Thx in advance!
Marcus.
Coordinator
Nov 21, 2008 at 8:06 AM

The most common problem is that IIS / ASP.Net user doesn't have enough rights to write a file to the Upload directory.

It's not possible to give a more detailed error message in Silverlight.

Silverilght makes a webservice call. If something goes wrong, the service will send a certain HTTP error code. But these codes are hidden from plugins running in the browser. All Silverlight gets is HTTP 200 (OK) or HTTP 404 (not found / something went wrong). That's it, nothing more.

It's too bad, but that's why the message is not more detailed, like "Not enough rights" / "Service not found" etc.

So when problems like these occur, the only thing you can do is find out if the problem is:
A) Silverlight can't access the webservice
B) Something goes wrong in the webservice

You can easily figure this out by debugging or writing some quick logging code in the WCF service.