I have an upload application that works on my development machine, but does not work on my "staging" server, which is a windows 2008 R2 Web server. I have checked every setting that I can think of, against the same setting on the development machine, they alll match. However, I get an error when trying to upload the photos. I have followed your instructions in the KB about troubleshooting the issue, and my comments are attached. Is there anything else I can try, I am looking at logging steps within the handler to troubleshooting this.I had some screen prints in the word document, see attached, which did not get "pasted" into this control.
Test the upload handler in your browser - navigate it to the full path of the handler:
You should see the following output if everything is done correctly:
Yes, I can see the same, see above.
- Absolute Path for upload handler.
If you initialize the UploadServiceUrl property with a full-path value like:
UploadServiceUrl = "http://localhost:6242/MyUploadHandler.ashx"
then you will not be able to access it after the deployment.
To resolve this issue you should use a relative path:
UploadServiceUrl = "~/MyUploadHandler.ashx"
UploadServiceUrl = "../MyUploadHandler.ashx"
Tried; ~/Images.ashx, /Images.ashx, Images.ashx, ../Images.ashx. All with the same result, set up a database table to change the address of the upload handler, tried all of the previously noted options.
- Upload Storage directory.
Check the existence of the storage directory. Ensure the upload handler has credentials to write in it.
Actually, there are two properties to set the name of the storage directory:
- TargetFolder: use this property if the storage folder is relative to the upload handler:
- TargetPhysicalFolder: use this one with full path of the storage folder
If both TargetPhysicalFolder and TargetFolder are set, the TargetPhysicalFolder will take precedence.
Ensured that “everyone” has read/write access to the share, and set the folder up as a virtual folder.
Using Full Trust, therefore irrelevant.
- Cross-Domain issue.
In order to increase the security, Microsoft restricted the cross-domain service call in Silverlight. If your Silverlight application and Upload handler are on different domains than you definitely will enter the cross-domain case. In this case you should deploy a client access policy file. Actually, you have a choice to deploy the native to the Silverlight clientaccesspolicy.xml file, or the adopted (from Adobe Flash) crossdomain.xml. More about this case you can find in following links: link-1, link-2, link-3, link-4.
In the same domain.
- Window 7 and IIS Security Exception.
If the upload handler is hosted on Windows then you can experience the Security Exception issue. This is due to the default settings of the IIS in Windows 7. Below, you can find both the explanation and the resolution:
- Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permissions please contact your system administrator or change the application's trust level in the configuration file.
- Exception Details: System.Security.SecurityException:Request for the permission of type 'System.Web.AspNetHostingPermission,...
- Cause: Microsoft changed the default setting of the Load User Profile setting of the application pools in Windows 7 and Windows 2008 (the older one was True, in IIS7.5 it is False).
- Suggested solution: Open the Advanced Settings of the Application Pool and set the Load User Profile property to True.
Tried both true and false setting, no exception as described above.
- Antivirus and Indexing services.
Yes this one is a common yet mystery case. Sometimes upload succeeded sometimes break with exception like "Handler not found", "Handler not found or execution of the handler failed" or "File is not accessible". If these services are intentionally active then the only resolution is to upload files with different extension (for example ".radupload") and renamed again only after successful upload. Of course the chosen file-extension should be excluded from the services' spectrum.
No anti-virus on the machine and indexing disabled on the directory.