如何使用 MVC 项目中的服务结构参与者模型?
How can I use the service fabric actor model from MVC project?
我在 visual studio 2015 年使用有状态参与者模板来创建服务结构服务。在同一个解决方案中,我创建了一个 MVC 应用程序,并在关于控制器中尝试从示例客户端复制代码。当我 运行 Web 应用程序并执行它只是挂起的操作。我没有得到异常或任何表明它为什么不起作用的信息。 运行 我在其中获取代码的示例客户端控制台应用程序工作正常。有什么错误的建议吗?
public ActionResult About()
{
var proxy = ActorProxy.Create<IO365ServiceHealth>(ActorId.NewId(), "fabric:/O365Services");
try
{
int count = 10;
Console.WriteLine("Setting Count to in Actor {0}: {1}", proxy.GetActorId(), count);
proxy.SetCountAsync(count).Wait(); /* Hangs here */
Console.WriteLine("Count from Actor {0}: {1}", proxy.GetActorId(), proxy.GetCountAsync().Result);
}
catch (Exception ex)
{
Console.WriteLine("{0}", ex.Message);
}
ViewBag.Message = "Your application description page.";
return View();
}
MVC 应用程序是否托管在 Service Fabric 中?如果不是,那么它将无法访问 Service Fabric 信息,除非它以某种方式公开(例如,通过服务上的 OwinCommunicationListener)。
我在 visual studio 2015 年使用有状态参与者模板来创建服务结构服务。在同一个解决方案中,我创建了一个 MVC 应用程序,并在关于控制器中尝试从示例客户端复制代码。当我 运行 Web 应用程序并执行它只是挂起的操作。我没有得到异常或任何表明它为什么不起作用的信息。 运行 我在其中获取代码的示例客户端控制台应用程序工作正常。有什么错误的建议吗?
public ActionResult About()
{
var proxy = ActorProxy.Create<IO365ServiceHealth>(ActorId.NewId(), "fabric:/O365Services");
try
{
int count = 10;
Console.WriteLine("Setting Count to in Actor {0}: {1}", proxy.GetActorId(), count);
proxy.SetCountAsync(count).Wait(); /* Hangs here */
Console.WriteLine("Count from Actor {0}: {1}", proxy.GetActorId(), proxy.GetCountAsync().Result);
}
catch (Exception ex)
{
Console.WriteLine("{0}", ex.Message);
}
ViewBag.Message = "Your application description page.";
return View();
}
MVC 应用程序是否托管在 Service Fabric 中?如果不是,那么它将无法访问 Service Fabric 信息,除非它以某种方式公开(例如,通过服务上的 OwinCommunicationListener)。