Status 500 - Internal Server Error

Jul 24, 2012 at 2:12 AM

I'm trying to upload some memory stream using UploadClient's "UploadStreamAsync", but it seems to not upload anything and still give me back a completion event (didn't notice some error event handler, is there some error status for the client that I'm supposed to check upon completion?)

I get the following trace using the procedure described in

(and tracing for all status codes: 100-999)


ModuleName ManagedPipelineHandler
Notification 128
HttpStatus 500
HttpReason Internal Server Error
HttpSubStatus 0
ErrorCode 0
ErrorCode The operation completed successfully. (0x0)

Any hints on what may be failing?

Jul 24, 2012 at 2:25 AM

Seems that at the web project there were other package names at UploadHandler and at Global.asax/Global.asax.cs which must have been causing this (had copied those from source code web sample [the handler generated from nuget package had the upload folder hardcoded whereas the other one takes it from Global.asax.cs]).

Now I don't get any more failed request trace logs, but my code still silently fails to upload the stream to the server. What should I do for troubleshooting?


Jul 24, 2012 at 2:26 AM
Edited Jul 24, 2012 at 2:27 AM

the code I use for upload is:

string filename = Guid.NewGuid().ToString()+".wav";
theMemStream.Position = 0; //must point to start of stream
uploader2.UploadStreamAsync(theMemStream, filename); //, null, false); //if we set to true the player won't be able to play
uploader2.UploadCompleted += (sender, e) =>         {           
Jul 24, 2012 at 2:34 AM

Seems there was a real FileUpload.ashx file (apart from the virtual mapping in web.config) at the publish folder on IIS, since publish to folder doesn't remove old files and the old uploader had been using that filename. Had removed from project once I realized that, but forgot to remove from publish folder too on IIS. Now I get trace:

ModuleName ManagedPipelineHandler
Notification 16
HttpStatus 404
HttpReason Not Found
HttpSubStatus 0
ErrorCode 0
ErrorCode The operation completed successfully. (0x0)
Jul 24, 2012 at 2:52 AM
Edited Jul 24, 2012 at 2:55 AM

The handler is at a virtual App named AudioUpload that's inside a folder /Alpha under wwwroot. So I tried both "/FileUpload.ashx" and "/Alpha/AudioUpload/FileUpload.ashx" but won't work. If I change to the following in web.config, then it doesn't log failed requests any more, but still won't upload the audio

				HSS Interlink HttpHandlers for:
				IIS7/Express Integrated Mode
      <add name="FileUpload" verb="GET,POST" path="FileUpload.ashx" type="HSS.Interlink.Web.FileUpload" />

You can try the project by downloading the latest sourcecode from and going to the Client\AudioUpload folder, open the AudioUpload.sln from there (you have to change MYSERVER at two places in MainForm.xaml.cs to your domain name and also to give modify rights at Uploads subfolder to the user "IIS APPPOOL\DefaulAppPool" or whatever apppool you decide to run the website under).

 I really don't get what's the problem (going to sleep since its early in the morning here)

Jul 24, 2012 at 5:21 AM
Edited Jul 24, 2012 at 5:21 AM

OK, I tried it this evening, and got it working for you. I've outlined what I did.

* Client Side Changes

a. uploader2.Initialize("FileUpload.ashx", "UploadHandler", true);

* Server Side Web Config Changes

a. Uncommented the httpHandlers section since it's running in VS Dev Mode
b. Commented the handlers section since it's running in VS Dev Mode
c. Had to add the assembly name in the AppSetting section (see below)

<add key="UploadHandler" value="AudioUpload.Web.UploadHandler, AudioUpload.Web" />
Jul 24, 2012 at 1:54 PM

Did it work for you with IIS too? Can't seem to make it work with IIS, I even tried changing web.config to the following (added ", HSS.Interlink.Web" to handlers)

<?xml version="1.0" encoding="utf-8"?>
  For more information on how to configure your ASP.NET application, please visit
    <compilation debug="true" targetFramework="4.0" />
      HSS Interlink HttpHandlers for:
      IIS7/Express Classic Mode
       <add verb="GET,POST" path="FileUpload.ashx" type="HSS.Interlink.Web.FileUpload, HSS.Interlink.Web" />
    <add key="UploadHandler" value="AudioUpload.Web.UploadHandler, AudioUpload.Web" />
        <clear />
        <add value="AudioUploadTestPage.aspx" />
      HSS Interlink HttpHandlers for:
      IIS7/Express Integrated Mode
      <add name="FileUpload" verb="GET,POST" path="FileUpload.ashx" type="HSS.Interlink.Web.FileUpload, HSS.Interlink.Web" />
btw, it would be nice if the NUGET package for interlink generated web.config with the comments above the handlers/httphandlers 
sections instead of in them, so that you could easily comment them out as above and also to include the assembly at the handler 
(the HSS.Interlink.Web) and at the appsettings key (the assembly of the project) if both of them are needed
Jul 24, 2012 at 1:55 PM

WHen you go to IIS you have to toggle the handlers section.

In dev mode use the system.web\httphandlers section

In prod/IIS use the system.webserver\handlers section


Jul 24, 2012 at 2:18 PM
Edited Jul 24, 2012 at 2:20 PM

changed my upload code to:

        uploader2.UploadCompleted += (sender, e) =>
          if (e.Error != null)
            StatusText = e.Error.Message;
            linkStatus.NavigateUri = null;
          { ...

and I see the message:

Access to the path 'c:\inetpub\wwwroot\AudioUpload\temp\Uploads' is denied

I searched the web project for temp and couldn't find any reference of it. Is some code in interlink library hardcoding that?

I had created Uploads folder and had told the Global.asax

	public static string StoredFiles = @"Uploads";
since the handler in your demo used that (the handler generated by the nuget package has hardcoded value as constant)
So I'd expect it to have some param for the temp path and let me say specify "tempUploads" instead of it trying to make a temp folder AND a subfolder Uploads in there
 (is it trying to put anything into temp or just into temp\Uploads?)
Jul 24, 2012 at 2:25 PM

Yes, the Upload/Download Cache uses the temp folder (e.g., c:\inetpub\wwwroot\yourappfolder\temp\uploads\)

The default public static StoredFile = "Upload" can be whatever you want (it's assumed relative and is only there for convenience). You don't have to use it, you'll just have to modify your File Handler (UploadHandler.cs) to use whatever you want.

Your AppPool Identity needs to have read/write permissions on our app folder (e.g., c:\inetpub\wwwroot\yourappfolder) so it can created files/directories etc.


Jul 24, 2012 at 2:38 PM

I prefer for security reasons to not give write permission to the app's folder, so that any exploit against it won't be able to inject code to the folder. So supposing I have StoredFile="Uploads", can I pre-create and give "modify" right to "IIS APPPOOL\DefaultAppPool" to the following folders?

1) temp\Uploads

2) Uploads

would that be enough? Or do I need to give the same rights to "temp" too, even if I gave it to temp\Uploads? (if you only put stuff in temp/<StoreFile>, that is temp/Uploads in this case I guess I don't need to give access to temp too)

also it would be nice if I could pass the temp folder as param from config when I define your handler in handlers/httpHandlers section (I understand it makes subfolders for each handler I define via the key in appconfig).

As an extra, you could also have each user handler optionally define a temp folder themselves for more flexibility (overriding your wrapper's setting which is saving at temp\HandlerName or at customtemp\HandlerName if you add the previously mentioned feature) and for consistency with the fact that they can define their own upload folder (instead of just some subfolder under a common upload folder)

Jul 24, 2012 at 2:51 PM

Everything seems to be working fine now, thank you very much for your help

Uploaded the latest version that works on IIS to (folder Client/AudioUpload in the sourcecode). Added info to README.TXT there on what access rights the user has to give and to which folders for it to work on IIS and how they can rename the Uploads folder

The needed rights are modify to temp\Uploads and Uploads folders (same name as the folder defined in Global.asax in the web project) only for the "IIS APPPOOL\DefaultAppPool" (or whatever other apppool the app is running under)

Jul 24, 2012 at 2:56 PM

Yes you can manually create the folders and give just them the needed permissions.

Also, it does not create subfolders for each HTTP handler nor for each File Handler, you could have three different file handlers that save files to three different locations or the same location.

The only required folder is /temp/uploads as that is where the UploadTempCache stores it's files and is part of HSS Interlink. The File Handler (UploadHandler.cs) is your code, and you can save files to where ever you wish. If you where to save your uploaded files to a database you wouldn't need the \Uploads folder at all and one would not be created.

To clarify, it is the UploadTempCache that is hardcoded to use the /temp/uploads folder, which is used by the Interlink HTTP Handler. So to make it configurable, the TempUploadCache is where it would be configured not the HTTP Handler.

If you want the ability to configure the TempCache folder, please submit an Issue/Request and we will put it on the list for the next release.

Thanks for all the great interaction and recommendations.

Jul 24, 2012 at 3:00 PM

Glad to hear you got it working in IIS. Let us know if you need anything else.

Thanks again for all your recommendations and please be sure and give a good review if you're pleased with our product.


Jul 26, 2012 at 12:48 PM
Edited Jul 26, 2012 at 12:55 PM

just a note for future visitors to this thread who may want to extend the AudioUpload demo: with a little work you could replace the audio upload UI with a nicer looking one that uses MVVM concept -

I also posted a note at the original audio capture/upload sample, where somebody was complaining about the big-file-uploads issue he also had with that other upload code: