{"action":"created","issue":{"url":"https://api.github.com/repos/akkadotnet/akka.net/issues/2243","repository_url":"https://api.github.com/repos/akkadotnet/akka.net","labels_url":"https://api.github.com/repos/akkadotnet/akka.net/issues/2243/labels{/name}","comments_url":"https://api.github.com/repos/akkadotnet/akka.net/issues/2243/comments","events_url":"https://api.github.com/repos/akkadotnet/akka.net/issues/2243/events","html_url":"https://github.com/akkadotnet/akka.net/issues/2243","id":169835699,"number":2243,"title":"WebApi and Persistent Actor not working together","user":{"login":"joshuadeanhall","id":1972536,"avatar_url":"https://avatars.githubusercontent.com/u/1972536?v=3","gravatar_id":"","url":"https://api.github.com/users/joshuadeanhall","html_url":"https://github.com/joshuadeanhall","followers_url":"https://api.github.com/users/joshuadeanhall/followers","following_url":"https://api.github.com/users/joshuadeanhall/following{/other_user}","gists_url":"https://api.github.com/users/joshuadeanhall/gists{/gist_id}","starred_url":"https://api.github.com/users/joshuadeanhall/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joshuadeanhall/subscriptions","organizations_url":"https://api.github.com/users/joshuadeanhall/orgs","repos_url":"https://api.github.com/users/joshuadeanhall/repos","events_url":"https://api.github.com/users/joshuadeanhall/events{/privacy}","received_events_url":"https://api.github.com/users/joshuadeanhall/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-08-08T03:11:52Z","updated_at":"2016-08-08T07:51:29Z","closed_at":"2016-08-08T07:51:29Z","body":"I have the following code in my Global.asax\r\n\r\n`    public class WebApiApplication : System.Web.HttpApplication\r\n    {\r\n        protected void Application_Start()\r\n        {\r\n            \r\n\r\n\r\n            AreaRegistration.RegisterAllAreas();\r\n            GlobalConfiguration.Configure(WebApiConfig.Register);\r\n            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);\r\n            RouteConfig.RegisterRoutes(RouteTable.Routes);\r\n\r\n            BundleConfig.RegisterBundles(BundleTable.Bundles);\r\n\r\n           \r\n            var system = ActorSystem.Create(\"MyServer\");\r\n\r\n            var persistentActor = system.ActorOf(Props.Create<PersonActor>(), \"employeeActor\");\r\n            persistentActor.Tell(\"test\");\r\n\r\n        }\r\n        \r\n    }`\r\n\r\n\r\n\r\nPersonActor is as follows (In a sepearte project)\r\n\r\n`    public class PersonActor : UntypedPersistentActor\r\n    {\r\n        protected override void OnCommand(object message)\r\n        {\r\n            Console.WriteLine(\"Message recieved \" + message);\r\n            Sender.Tell(\"Test\");\r\n\r\n\r\n        }\r\n\r\n        public override string PersistenceId => \"PersistentPerson\";\r\n\r\n        protected override void OnRecover(object message)\r\n        {\r\n            \r\n\r\n        }\r\n    }`\r\n\r\nThe same code works in a console app and if I change to a UntypeActor that will also work in my WebAPI project.  \r\n\r\nI can't find anywhere that indicates that this shouldn't work in a web app.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/akkadotnet/akka.net/issues/comments/238165259","html_url":"https://github.com/akkadotnet/akka.net/issues/2243#issuecomment-238165259","issue_url":"https://api.github.com/repos/akkadotnet/akka.net/issues/2243","id":238165259,"user":{"login":"Danthar","id":986519,"avatar_url":"https://avatars.githubusercontent.com/u/986519?v=3","gravatar_id":"","url":"https://api.github.com/users/Danthar","html_url":"https://github.com/Danthar","followers_url":"https://api.github.com/users/Danthar/followers","following_url":"https://api.github.com/users/Danthar/following{/other_user}","gists_url":"https://api.github.com/users/Danthar/gists{/gist_id}","starred_url":"https://api.github.com/users/Danthar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Danthar/subscriptions","organizations_url":"https://api.github.com/users/Danthar/orgs","repos_url":"https://api.github.com/users/Danthar/repos","events_url":"https://api.github.com/users/Danthar/events{/privacy}","received_events_url":"https://api.github.com/users/Danthar/received_events","type":"User","site_admin":false},"created_at":"2016-08-08T07:51:29Z","updated_at":"2016-08-08T07:51:29Z","body":"var system = ActorSystem.Create(\"MyServer\");\r\nYou should store your `system` ref in a static variable. http://getakka.net/docs/deployment-scenarios/ASP%20NET\r\n\r\nWhat happens now is that your actor system is being disposed probably before the message is ever handled by your actor."}}
{"actor":{"display_login":"Danthar"}}