0

I'm trying develop a File Manage System for user upload/download file.

This system include two part(machine):

  1. Web Server(asp.net mvc) : File CRUD
  2. File Server (WCF) : using Windows File System or Nosql store file.

When use download a file, the process is...https://i.stack.imgur.com/gmL5K.png

The file has been send twice!

I hope File Server directly send file back to browser, but have no idea how to do it.

My wcf service contract is like:

interface FileService {
  Stream Download(string filename);
  void Upload(string filename, Stream file);
}

ASP.net mvc code:

class FileController : Controller {
  HttpResponseMessage Get(string filename) {
    // call wcf service here, and return.
  }
}

Please suggest, Thanks!


Update:

Not action call twice...

I mean the file send twice: from file server to web server to browser

Maybe it my program's architeture problem, wcf service shouldn't return a stream?

Duck
  • 1
  • 1
  • It's not WCF issue or anything between WCF and ASP.NET. I think it is related with executig `Action` twice in a controller. – Fka Nov 24 '14 at 09:18
  • I am sorry i didn't say it clearly, I had update my post... – Duck Nov 24 '14 at 10:24

1 Answers1

0

Take a look at this:asp-net-mvc-action-is-called-twice. They suggest to add a script for returning false when a link is clicked (don't mention the MVC2 version). If that doesn't help take a look at this page-loads-twice-in-google-chrome. If you have an img tag with an empty src element in your html that might cause the double call.

Community
  • 1
  • 1
Dennis Nerush
  • 5,473
  • 5
  • 25
  • 33