So we have an extremely random error (by which I mean, there appears to be no usage pattern that precedes the error) in our C# ASP.NET MVC5 application, that occurs in our production environment.
The error appears to occur only sometimes after a user logs in, and the entire system crashes and becomes inaccessible to all users until we manually go into IIS8 and restart the web server. We are running SQL Server Express 2012 SP2 on a windows server 2012 environment with IIS.
The error message as follows:
IndexOutOfRangeException/Account/Login
Index was outside the bounds of the array.
The stack trace is as follows:
IndexOutOfRangeException·Index was outside the bounds of the array.
Raw
:0System.Data.SqlClient.SqlDataReader.CheckHeaderIsReady(Int32 columnIndex, Boolean permitAsync, String methodName)
:0System.Data.SqlClient.SqlDataReader.IsDBNull(Int32 i)
:0System.Data.Entity.Core.Common.Internal.Materialization.Shaper+ErrorHandlingValueReader`1.GetValue(DbDataReader reader, Int32 ordinal)
:0lambda_method(Closure , Shaper )
:0System.Data.Entity.Core.Common.Internal.Materialization.Shaper.HandleEntityAppendOnly(Func`2 constructEntityDelegate, EntityKey entityKey, EntitySet entitySet)
:0lambda_method(Closure , Shaper )
:0System.Data.Entity.Core.Common.Internal.Materialization.Coordinator`1.ReadNextElement(Shaper shaper)
:0System.Data.Entity.Core.Common.Internal.Materialization.Shaper`1+SimpleEnumerator+<MoveNextAsync>d__4.MoveNext()
:0System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
:0System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
:0System.Data.Entity.Internal.LazyAsyncEnumerator`1+<FirstMoveNextAsync>d__0.MoveNext()
:0System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
:0System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
:0System.Data.Entity.Infrastructure.IDbAsyncEnumerableExtensions+<FirstOrDefaultAsync>d__25`1.MoveNext()
:0System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
:0System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
:0Microsoft.AspNet.Identity.TaskExtensions+CultureAwaiter`1.GetResult()
:0Microsoft.AspNet.Identity.EntityFramework.UserStore`6+<GetUserAggregateAsync>d__6c.MoveNext()
:0System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
:0System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
:0Microsoft.AspNet.Identity.TaskExtensions+CultureAwaiter`1.GetResult()
:0Microsoft.AspNet.Identity.UserManager`2+<FindAsync>d__12.MoveNext()
:0System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
:0System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
:0Saleboat.Controllers.AccountController+<Login>d__9.MoveNext()
:0System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
:0System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
:0System.Web.Mvc.Async.TaskAsyncActionDescriptor.EndExecute(IAsyncResult asyncResult)
:0System.Web.Mvc.Async.AsyncControllerActionInvoker+<>c__DisplayClass37.<BeginInvokeAsynchronousActionMethod>b__36(IAsyncResult asyncResult)
:0System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult)
:0System.Web.Mvc.Async.AsyncControllerActionInvoker+AsyncInvocationWithFilters.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3d()
:0System.Web.Mvc.Async.AsyncControllerActionInvoker+AsyncInvocationWithFilters+<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f()
:0System.Web.Mvc.Async.AsyncControllerActionInvoker+AsyncInvocationWithFilters+<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f()
:0System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult)
:0System.Web.Mvc.Async.AsyncControllerActionInvoker+<>c__DisplayClass21+<>c__DisplayClass2b.<BeginInvokeAction>b__1c()
:0System.Web.Mvc.Async.AsyncControllerActionInvoker+<>c__DisplayClass21.<BeginInvokeAction>b__1e(IAsyncResult asyncResult)
This error only occurs on our live server/database and cannot be intentionally reproduced, we pretty much have to wait for it to happen and review the exception caught by Bugsnag.
EDIT
Here is the code executed upon sign in:
[HttpPost]
[AllowAnonymous]
[ValidateAntiForgeryToken]
public async Task<ActionResult> Login(LoginViewModel model, string returnUrl)
{
if (ModelState.IsValid)
{
var user = await UserManager.FindAsync(model.UserName, model.Password);
if (user != null)
{
var userId = UserManager.FindByName(model.UserName).Id;
int companyId = db.Users.Find(userId).CompanyId;
await SignInAsync(user, model.RememberMe);
return RedirectToLocal(returnUrl);
}
else
{
ModelState.AddModelError("", "Invalid username or password.");
}
}
return View(model);
}
Related
I was developing a blog project based on asp.net core mvc and trying to deploy my project on ubuntu 16.04 LTS x86-64.
And I encountered a null reference exception while using transactionScope with dapper on inserting object to sql server.
The SQL server version is: 12.0.4100.1 running on a Windows 2012SP1 system.
and the code was running just fine on Windows 10 (OS Build 17074.1002).
but when I deploy the project to Ubuntu, it throws null reference exceptions.
the exception details was like:
{System.NullReferenceException: Object reference not set to an instance of an object. at
System.Data.ProviderBase.DbConnectionPool.DeactivateObject(DbConnectionInternal
obj) at
System.Data.ProviderBase.DbConnectionPool.PutObject(DbConnectionInternal
obj, Object owningObject) at
System.Data.ProviderBase.DbConnectionInternal.CloseConnection(DbConnection
owningObject, DbConnectionFactory connectionFactory) at
System.Data.SqlClient.SqlConnection.CloseInnerConnection() at
System.Data.SqlClient.SqlConnection.Close() at
Dapper.SqlMapper.d__64 1.MoveNext() in
C:\projects\dapper\Dapper\SqlMapper.Async.cs:line 1191
--- End of stack trace from previous location where exception was thrown --- at
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task
task) at
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
task) at
System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
at System.Runtime.CompilerServices.TaskAwaiter 1.GetResult() at
Autyan.NiChiJou.Repository.Dapper.BaseDapperRepository
1.d__22.MoveNext() in /home/alex/Documents/Github/Autyan.NiChiJou/src/Autyan.NiChiJou.Repository.Dapper/BaseDapperRepository.cs:line
167
--- End of stack trace from previous location where exception was thrown --- at
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task
task) at
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
task) at
System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
at System.Runtime.CompilerServices.TaskAwaiter 1.GetResult() at
Autyan.NiChiJou.Repository.Dapper.LongKeyDapperRepository
1.d__1.MoveNext() in /home/alex/Documents/Github/Autyan.NiChiJou/src/Autyan.NiChiJou.Repository.Dapper/LongKeyDapperRepository.cs:line
23
--- End of stack trace from previous location where exception was thrown --- at
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task
task) at
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
task) at
System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
at System.Runtime.CompilerServices.TaskAwaiter 1.GetResult() at
Autyan.NiChiJou.Service.Blog.ArticleService.d__10.MoveNext()
in
/home/alex/Documents/Github/Autyan.NiChiJou/src/Autyan.NiChiJou.Service.Blog/ArticleService.cs:line
39}
my code that throws exception is like this:
using (var scope = new TransactionScope(TransactionScopeAsyncFlowOption.Enabled))
{
var create = await ArticleRepo.InsertAsync(article);
if (create <= 0)
{
return Failed<Article>("create article failed");
}
create = await ContentRepo.InsertAsync(new ArticleContent
{
ArticleId = create,
Content = content
});
if (create <= 0)
{
return Failed<Article>("create articleContent failed");
}
scope.Complete();
}
I tried to remove the transactionScope and after that, my codes run just fine with everything
the new code was like:
var create = await ArticleRepo.InsertAsync(article);
if (create <= 0)
{
return Failed<Article>("create article failed");
}
create = await ContentRepo.InsertAsync(new ArticleContent
{
ArticleId = create,
Content = content
});
if (create <= 0)
{
return Failed<Article>("create articleContent failed");
}
Am I using trancsationScope the wrong way? Or it's just a bug from dotnet core itself?
It is because when await is over, thread assigned to continue execution of statements following await already lost the transaction context that original executing thread had.
Define your Txn Scope as :
using (var scope = new TransactionScope(..., TransactionScopeAsyncFlowOption.Enabled))
Hi I'm new to MVC having done web forms for several years.
When users reach our site they are already authenticated by our organization's central authentication service. We already have all users in our SQL Server database and just need to match their identity and assign the appropriate authorizations. I customized https://aspnet.codeplex.com/SourceControl/latest#Samples/Identity/AspNet.Identity.MySQL/Readme.txt for use with our existing SQL Server.
I'm getting a "UserId not found" error.
Here is the stack trace:
[InvalidOperationException: UserId not found.]
Microsoft.AspNet.Identity.<GetSecurityStampAsync>d__42.MoveNext() +651
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +144
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +84
System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() +49
Microsoft.AspNet.Identity.CultureAwaiter`1.GetResult() +109
Microsoft.AspNet.Identity.<CreateAsync>d__0.MoveNext() +1350
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +144
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +84
System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() +49
Security.Models.<GenerateUserIdentityAsync>d__0.MoveNext() in T:\Security\Models\IdentityModels.cs:16
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +144
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +84
Microsoft.AspNet.Identity.Owin.<SignInAsync>d__2.MoveNext() +437
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +144
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +84
Security.Controllers.<Login>d__10.MoveNext() in T:\Security\Controllers\AccountController.cs:77
Here is where the error occurs in IdentityModel.cs:
public async Task<ClaimsIdentity> GenerateUserIdentityAsync(UserManager<ApplicationUser> manager)
{
var userIdentity = await manager.CreateIdentityAsync(this, DefaultAuthenticationTypes.ApplicationCookie);
Below is my AccountController.cs code based on:
ASP.NET MVC Identity login without password
var user = await UserManager.FindByNameAsync(id);
var result = await UserManager.CreateAsync(user);
if (result.Succeeded)
{
await SignInManager.SignInAsync(user, isPersistent: true, rememberBrowser: true);
}
I removed
var userIdentity = await manager.CreateIdentityAsync(this, DefaultAuthenticationTypes.ApplicationCookie);
and replaced it with
var userIdentity = new ClaimsIdentity(new[]
{
// adding following 2 claims for supporting default antiforgery provider
new Claim(ClaimTypes.NameIdentifier, this.UserName),
new Claim("http://schemas.microsoft.com/accesscontrolservice/2010/07/claims/identityprovider", "ASP.NET Identity", "http://www.w3.org/2001/XMLSchema#string"),
new Claim(ClaimTypes.Name, this.UserName),
new Claim("AspNet.Identity.SecurityStamp", this.SecurityStamp),
//new Claim(ClaimTypes.Role, AppRoleClaims.Client),
new Claim(ClaimTypes.Sid, this.Id.ToString())
},
DefaultAuthenticationTypes.ApplicationCookie);
I found this code at How can I log a Client in Asp.Net MVC with no user. It appears to have solved the issue I was having.
If you have the userid change await UserManager.FindByNameAsync(id) -> await UserManager.FindByIdAsync(Id)
FindByNameAsync -> is finding for the matching username
Hi you can use this method UserManager.FindByIdAsync Method, it will Finds a user by ID.
ex:
var user = await UserManager.FindByIdAsync(userid);
I have an IIS set-up for my Web API application. One of the functions in my Web API calls on a SOAP web service. When I try to call on my Web API using my other project, it returns a Unable to connect to the remote server error.
Strange thing is, when I run my Web API application in debug mode, the error does not show and it works as intended.
Here is a rough draft of how I call the Web API:
static async Task RunAsyncBlogs()
{
using (var client = new HttpClient())
{
client.BaseAddress = new Uri("http://ph-lb-d12/my_webapi/");
client.DefaultRequestHeaders.Accept.Clear();
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("text/xml"));
var success = "";
// HTTP GET
HttpResponseMessage response = await client.GetAsync("api/Controller/DoAction");
if (response.IsSuccessStatusCode)
{
success = "yes";
}
else
{
success = "no";
}
}
}
Next, here is how I call on the web service from my Web API solution:
Assume that GetXMLData is the function that the API Controller calls
public XmlDocument GetXMLData()
{
var xmlRaw = "";
XmlDocument xmldoc = new XmlDocument();
WS.Service webService = new WS.Service();
xmlRaw = webService.DoAction("TEST").OuterXml; //THIS IS WHERE THE ERROR OCCURS
xmldoc.Load(xmlRaw);
return xmldoc;
}
Assume that this all works when the Web API solution is in debug mode. But when it isn't. It returns this:
<Error><Message>An error has occurred.</Message><ExceptionMessage>Unable to connect to the remote server</ExceptionMessage><ExceptionType>System.Net.WebException</ExceptionType><StackTrace> at cemws.Core.PLI.GetXMLFeed() in e:\micron\cem\PROTOTYPE\cemws\src\cemws\Core\PLI.cs:line 70 at cemws.Controllers.IntegrationController.GetPLIFeed() in e:\micron\cem\PROTOTYPE\cemws\src\cemws\Controllers\IntegrationController.cs:line 42 at lambda_method(Closure , Object , Object[] ) at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass10.<GetExecutor>b__9(Object instance, Object[] methodParameters) at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken)
--- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() at System.Web.Http.Controllers.ApiControllerActionInvoker.<InvokeActionAsyncCore>d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() at System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__2.MoveNext()
--- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() at System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__1.MoveNext()</StackTrace><InnerException><Message>An error has occurred.</Message><ExceptionMessage>A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
10.2.1.3:8080</ExceptionMessage><ExceptionType>System.Net.Sockets.SocketException</ExceptionType><StackTrace> at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress) at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception)</StackTrace></InnerException></Error>
I'm developing an application using Silverlight. I've created WebAPI project in my solution:
BusinessApplication8
BusinessApplication8.Web
BusinessApplication8.WebAPI
First one is Silverlight project, second one contains my EDMX file. In my WebAPI project I'm using my DbContext like this:
public IEnumerable <object> Get()
{
var database = new DABIREntities();
var query = database.noe_nameh.Take(1).Select(item = > new {
Id = item.uid,
Description = item.sharh
}).ToList();
return query;
}
Everything works fine in local host and I get result in the browser. When I publish my WebAPI project and Call that GET method via URL I'm getting this error:
<Error>
<Message>An error has occurred.</Message>
<ExceptionMessage>
Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
</ExceptionMessage>
<ExceptionType>System.Reflection.ReflectionTypeLoadException</ExceptionType>
<StackTrace>
at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module) at System.Reflection.RuntimeModule.GetTypes() at System.Reflection.Assembly.GetTypes() at
System.Data.Metadata.Edm.ObjectItemAttributeAssemblyLoader.LoadTypesFromAssembly() at System.Data.Metadata.Edm.ObjectItemAssemblyLoader.Load() at
System.Data.Metadata.Edm.AssemblyCache.LoadAssembly(Assembly assembly, Boolean loadReferencedAssemblies, ObjectItemLoadingSessionData loadingData) at
System.Data.Metadata.Edm.AssemblyCache.LoadAssembly(Assembly assembly, Boolean loadReferencedAssemblies, KnownAssembliesSet knownAssemblies, EdmItemCollection
edmItemCollection, Action`1 logLoadMessage, Object& loaderCookie, Dictionary`2& typesInLoading, List`1& errors) at
System.Data.Metadata.Edm.ObjectItemCollection.LoadAssemblyFromCache(ObjectItemCollection objectItemCollection, Assembly assembly, Boolean loadReferencedAssemblies,
EdmItemCollection edmItemCollection, Action`1 logLoadMessage) at System.Data.Metadata.Edm.ObjectItemCollection.ImplicitLoadAssemblyForType(Type type, EdmItemCollection
edmItemCollection) at System.Data.Metadata.Edm.MetadataWorkspace.ImplicitLoadAssemblyForType(Type type, Assembly callingAssembly) at
System.Data.Objects.ObjectContext.GetTypeUsage(Type entityCLRType) at System.Data.Objects.ObjectContext.CreateObjectSet[TEntity](String entitySetName) at
BusinessApplication8.Web.DABIREntities.get_noe_nameh() at BusinessApplication8.WebAPI.Controllers.SearchController.Get() at lambda_method(Closure , Object , Object[] )
at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass10.<GetExecutor>b__9(Object instance, Object[] methodParameters) at
System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken
cancellationToken) --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task
task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() at
System.Web.Http.Controllers.ApiControllerActionInvoker.<InvokeActionAsyncCore>d__0.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() at
System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__2.MoveNext() --- End of stack trace from previous location where exception was thrown --- at
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
task) at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() at System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__1.MoveNext()
</StackTrace>
</Error>
Any Idea?
Finally I solved my problem. First of all I changed my API method to this:
public IEnumerable<object> Get()
{
try
{
var database = new DABIREntities();
var query = database.noe_nameh.Take(1).Select(item => new
{
Id = item.uid,
Description = item.sharh
}).ToList();
return query;
}
catch (ReflectionTypeLoadException exception)
{
return exception.LoaderExceptions.Select(item => item.Message).ToList();
}
}
That helped me to figure out my exact exceptions. We should set Copy to Local to below dll:
System.ServiceModel
System.ServiceModel.DomainServices.EntityFramework
System.ServiceModel.DomainServices.Hosting
System.ServiceModel.DomainServices.Server
I've been trying to call a method on my hub from a signalr .Net client however it throws the following exception:
[ArgumentNullException: Value cannot be null.
Parameter name: s]
System.IO.StringReader..ctor(String s) +10894409
Microsoft.AspNet.SignalR.Json.JsonSerializerExtensions.Parse(JsonSerializer serializer, String json) +63
Microsoft.AspNet.SignalR.Hubs.HubRequestParser.Parse(String data, JsonSerializer serializer) +19
Microsoft.AspNet.SignalR.Hubs.HubDispatcher.OnReceived(IRequest request, String connectionId, String data) +40
Microsoft.AspNet.SignalR.<>c__DisplayClassc.<ProcessRequest>b__7() +34
Microsoft.AspNet.SignalR.TaskAsyncHelper.FromMethod(Func`1 func) +28
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +93
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +52
Microsoft.AspNet.SignalR.Transports.<ProcessSendRequest>d__10.MoveNext() +364
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +93
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +52
Microsoft.Owin.Mapping.<Invoke>d__0.MoveNext() +386
Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.StageAsyncResult.End(IAsyncResult ar) +69
Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.IntegratedPipelineContext.EndFinalWork(IAsyncResult ar) +64
System.Web.AsyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +415
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155
This is when I try to invoke the method on a remote host, the weird thing when developing it it actually does work locally...
Here is the code of the hub:
public void UpdateLocalPlayerName(string name)
{
...
foreach (var connection in websiteConnections)
{
Clients.Client(connection.ConnectionID).UpdateLocalPlayerName(Context.ConnectionId, name);
}
}
And here is how I try to invoke it with the .Net client
public void UpdateLocalPlayerName(string name)
{
MainHubProxy.Invoke<string>("UpdateLocalPlayerName", name);
}
I am using 2.0.3.0 version of the .Net client and the server runs IIS8...
Any idea what causes this?
Seems to be I had www. infront of the server's url I was connecting to, guess the routing prevented the arguments from being passed correctly. Changed the url to the url without www and it worked.