0

I successfully implemented a WCF service (with wsDualHttpBinding) in MVC.

"SendResult" function get correctly called from WCF and receives the results in the "Events_For_Export_Result" array. Now I should redirect MVC to a controller/view to show a message, but I cannot invoke an action in the call back function.

As you can see below, I tried to make my callback class inherits from "Controller" and invoked a function that perform a "RedirectToAction", but it does not work.

What I am doing wrong? Is there a way to invoke an action in a void method?

public class GPWCFServiceCallBackController : Controller, IGPWCFServiceCallback
{

    public void SendResult(GPWCFService.Events_For_Export_Result[] arrEvents, string resultMessage)
    {
        ShowResult(arrEvents, resultMessage);
    }

    public ActionResult ShowResult(GPWCFService.Events_For_Export_Result[] arrEvents, string resultMessage)
    {
        return RedirectToAction("Index", "Home");

    }

} 

I think it has something to do with the nature of the wsDualHttpBinding. In fact, I cannot change the return type of the function, since I have to specify [OperationContract(IsOneWay = true)] attribute. In this way, the callback function must be void.

This is the callback interface:

/// <summary>
/// The Callback Interface
/// </summary>
public interface IGPWCFServiceCallback
{
    [OperationContract(IsOneWay = true)]
    void SendResult(Events_For_Export_Result[] arrEvents, string resultMessage);
}

1 Answers1

0

Your controller class name should ending with word Controller

Look at this question.

Community
  • 1
  • 1
Sousuke
  • 1,203
  • 1
  • 15
  • 25
  • 1
    Thanks Sousuke, yes I forgot it. I have changed it but it still does not work. It simply does nothing. –  Dec 24 '15 at 09:28