I am getting a null reference error on a asp.net application when it is on two Azure load balanced servers. When I turn off one the error goes away. When looking at the call stack there is not a real reason why a null reference has been thrown. I have even setup a remote debugging session on both servers and there is not a logical reason of why I am getting a null reference error. My gut says it works fine on one server but not when there is two so it must be a load balancing issue and I need to change my application setup to include load balancing. Is this a normal indication that something needs to change as far as application setup ? If so what needs to change? If not what other diagnostics can I run to get my application working on a cluster ?
System.InvalidOperationException: Nullable object must have a value.
at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource)
at POS.Domain.Manager.GetCommodityList(Int32 locationID, DateTime delDate, Int32 ogID, VMUserProfile profile) in c:\Workspace\Ordering Portals\DanielBranch\POS.Domain\BLL\Manager.cs:line 1123
at POS.UI.Controllers.OrderingController.GetCommodityList(Int32 locationID, String delDate, VMUserProfile userprofile) in c:\Workspace\Ordering Portals\DanielBranch\POS.UI\Controllers\OrderingController.cs:line 733
at lambda_method(Closure , ControllerBase , Object[] )
at System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters)
at System.Web.Mvc.Async.AsyncControllerActionInvoker.<BeginInvokeSynchronousActionMethod>b__39(IAsyncResult asyncResult, ActionInvocation innerInvokeState)
at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`2.CallEndDelegate(IAsyncResult asyncResult)
at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult)
at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3d()
at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f()
at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f()
at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult)
at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass21.<>c__DisplayClass2b.<BeginInvokeAction>b__1c()
at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass21.<BeginInvokeAction>b__1e(IAsyncResult asyncResult)
at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult)
at System.Web.Mvc.Controller.<BeginExecuteCore>b__1d(IAsyncResult asyncResult, ExecuteCoreState innerState)
at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult)
at System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult)
at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult)
at System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult)
at System.Web.Mvc.MvcHandler.<BeginProcessRequest>b__5(IAsyncResult asyncResult, ProcessRequestState innerState)
at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult)
at System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
It seems that your site is stateful, meaning that you are storing information on one server, so that if a user is sent to another server, that information will not be there. For instance, if you are using in-process Sessions, they will only exist on that one server.
Fortunately, there is a feature in Azure App Services that allows the user to be sent back to the same server each time.
Simply, turn on ARR Affinity setting under Application settings. This will ensure that the user is sent back to the same server on each request.
Source
Related
I have setup a subdomain via wildcard in my asp.net application. The subdomain routing works perfect, but for some reason if I refresh the page two times quickly I keep getting this error:
The remote server returned an error: (503) Server Unavailable.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Net.WebException: The remote server returned an error: (503) Server Unavailable.
Stacktrace:
[WebException: The remote server returned an error: (503) Server Unavailable.]
System.Net.WebClient.DownloadDataInternal(Uri address, WebRequest& request) +365
System.Net.WebClient.DownloadString(Uri address) +111
WebApplication3.Controllers.OtherController.Dynamic(String someValue, String Id) +2168
lambda_method(Closure , ControllerBase , Object[] ) +191
System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +229
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +35
System.Web.Mvc.Async.AsyncControllerActionInvoker.<BeginInvokeSynchronousActionMethod>b__39(IAsyncResult asyncResult, ActionInvocation innerInvokeState) +39
System.Web.Mvc.Async.WrappedAsyncResult`2.CallEndDelegate(IAsyncResult asyncResult) +77
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult) +69
System.Web.Mvc.Async.AsyncInvocationWithFilters.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3d() +72
System.Web.Mvc.Async.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f() +387
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult) +42
System.Web.Mvc.Async.<>c__DisplayClass2b.<BeginInvokeAction>b__1c() +38
System.Web.Mvc.Async.<>c__DisplayClass21.<BeginInvokeAction>b__1e(IAsyncResult asyncResult) +188
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +38
System.Web.Mvc.Controller.<BeginExecuteCore>b__1d(IAsyncResult asyncResult, ExecuteCoreState innerState) +29
System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +73
System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +52
System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +39
System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +38
System.Web.Mvc.MvcHandler.<BeginProcessRequest>b__5(IAsyncResult asyncResult, ProcessRequestState innerState) +43
System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +73
System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +38
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +602
System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) +195
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +128
The subdomain route is setup like this:
routes.MapSubDomainRoute("OtherRoute",
"{someValue}", // SubDomain
"{action}/{id}", // URL with parameters
new { controller = "Other", action = "Index", id = UrlParameter.Optional }, // Parameter defaults
new { someValue = new SubDomainConstraint() } // constraint so we only deal the subdomains we want
);
what could be the reason behind this issue ? Can someone help me out?
And the subdomain that I'm trying to access is:
http://subdomain.example.com/routeIdParameter
api cannot reach the installed servera
I am trying to have a single sign-in web app through azure that has an initial Microsoft login and then no second login. At the moment I am just trying to get 2 logins to work but when running locally I can get the app to work and show the Power BI reports using a dual login. But whenever I publish the app up to the Azure host and I try to access the power BI page instead of having a Microsoft popup to log in it just suffers from this error.
[COMException (0x80004005): Error HRESULT E_FAIL has been returned from a call to a COM component.]
Microsoft.IdentityModel.Clients.ActiveDirectory.AuthenticationContext.RunAsyncTask(Task`1 task) +89
MultiTenantWebApp.Controllers.PowerBiController.Autenticate() in C:\Users\G4Fro\Source\Repos\Intern\MultiTenantWebApp\MultiTenantWebApp\Controllers\PowerBiController.cs:165
MultiTenantWebApp.Controllers.PowerBiController.MakeGroupDictionary() in C:\Users\G4Fro\Source\Repos\Intern\MultiTenantWebApp\MultiTenantWebApp\Controllers\PowerBiController.cs:64
MultiTenantWebApp.Controllers.PowerBiController.EmbedReport() in C:\Users\G4Fro\Source\Repos\Intern\MultiTenantWebApp\MultiTenantWebApp\Controllers\PowerBiController.cs:32
lambda_method(Closure , ControllerBase , Object[] ) +62
System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) +14
System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +169
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +27
System.Web.Mvc.Async.AsyncControllerActionInvoker.<BeginInvokeSynchronousActionMethod>b__39(IAsyncResult asyncResult, ActionInvocation innerInvokeState) +22
System.Web.Mvc.Async.WrappedAsyncResult`2.CallEndDelegate(IAsyncResult asyncResult) +29
System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +49
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult) +32
System.Web.Mvc.Async.AsyncInvocationWithFilters.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3d() +50
System.Web.Mvc.Async.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f() +228
System.Web.Mvc.Async.<>c__DisplayClass33.<BeginInvokeActionMethodWithFilters>b__32(IAsyncResult asyncResult) +10
System.Web.Mvc.Async.WrappedAsyncResult`1.CallEndDelegate(IAsyncResult asyncResult) +10
System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +49
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult) +34
System.Web.Mvc.Async.<>c__DisplayClass2b.<BeginInvokeAction>b__1c() +26
System.Web.Mvc.Async.<>c__DisplayClass21.<BeginInvokeAction>b__1e(IAsyncResult asyncResult) +100
System.Web.Mvc.Async.WrappedAsyncResult`1.CallEndDelegate(IAsyncResult asyncResult) +10
System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +49
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +27
System.Web.Mvc.Controller.<BeginExecuteCore>b__1d(IAsyncResult asyncResult, ExecuteCoreState innerState) +13
System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +29
System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +49
System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +36
System.Web.Mvc.Controller.<BeginExecute>b__15(IAsyncResult asyncResult, Controller controller) +12
System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +22
System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +49
System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +26
System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult) +10
System.Web.Mvc.MvcHandler.<BeginProcessRequest>b__5(IAsyncResult asyncResult, ProcessRequestState innerState) +21
System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +29
System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +49
System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +28
System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +577
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +157
Any help would be greatly appreciated as I have no idea why it works offline but not online and I don't know how to understand the stack trace
This is the Authentication code
private void Authenticate()
{
string clientID = ""; // We have our client ID here that was created in power BI dev apps
string redirectUri = "https://localhost:44367/";
string resourceUri = "https://analysis.windows.net/powerbi/api";
string authorityUri = "https://login.windows.net/common/oauth2/authorize";
if (token == null)
{
AuthenticationContext authContext = new AuthenticationContext(authorityUri);
token = authContext.AcquireToken(resourceUri, clientID, new Uri(redirectUri)).AccessToken;
}
else
{
return;
}
}
HRESULT E_FAIL has been returned from a call to a COM component.
have no idea why it works offline but not online and I don't know how to understand the stack trace
According to the exception, it seems that you application try to access to out-of-process COM in the WebApp, but it is restricted in the Web App sandbox.
If it is restricted in the WebApp and Cloudservice is possible, please have try to use Cloudservice. About how to Migrate and Publish a Web Application to an Azure Cloud Service from Visual Studio, we could refer to this document.
I am getting this error at the moment and I am pretty sure it has to do with the fact that my azure app does not have the "Access the directory as the signed-in user" permission, since I am accessing Power BI as a master user as in the" App owns data" scenario.
Notes:
I only get this error when I unwind the aggregate exception. Otherwise the error message is "One or more errors occurred." Here is a good link on that: Flattening of Aggregate Exceptions
It looks like I have the permission, and that I have the rights to grant it, but when I click on the Grant permissions icon I get an error message saying I cannot grant that permission myself.
In fact the Azure documentation is clear here that you can grant that permission yourself only for Application Type:Native App, not Web app/API which is what I have here (so the UI has a display bug). Here is a link to it:Permission Scope Docs
I am still trying to figure out who my "Admin" is so that I can get this permission, so I am not yet sure that this is the whole issue. Will update.
I am using VS2013, Matlab 2015Ra, and IIS 10. Net framework is 4.5.2 and EF is 6. Matlab 2015Ra, VS2013, and IIS are 64 bit on windows 10 which is also 64 bit. I have MatLab script compiled as net assembly. When I use development server, the program works fine without error, while when it is deployed on IIS program fails to execute MatLab code with this exception message:
The MATLAB runtime instance could not be initialized
segv - SEVERE ERROR
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ApplicationException: The MATLAB runtime instance could not be initialized
segv - SEVERE ERROR
The complete stack trace is:
[ApplicationException: The MATLAB runtime instance could not be initialized
segv - SEVERE ERROR] MathWorks.MATLAB.NET.Utility.MWMCR..ctor(String componentId, String componentPath, Stream embeddedCtfStream, Boolean isLibrary) +282
[Exception: The MATLAB runtime instance could not be initialized]
MathWorks.MATLAB.NET.Utility.MWMCR..ctor(String componentId, String componentPath, Stream embeddedCtfStream, Boolean isLibrary) +736
BuildCrop.Cropper..cctor() +390
[Exception: MWArray assembly failed to be initialized]
BuildCrop.Cropper..ctor() +43
EMS.Controllers.AdministratorController.Test_CreateCrop() +186
lambda_method(Closure , ControllerBase , Object[] ) +87
System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext
controllerContext, IDictionary`2 parameters) +229
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +35
System.Web.Mvc.Async.AsyncControllerActionInvoker.<BeginInvokeSynchronousActionMethod>b__39(IAsyncResult asyncResult, ActionInvocation innerInvokeState) +39
System.Web.Mvc.Async.WrappedAsyncResult`2.CallEndDelegate(IAsyncResult asyncResult) +67
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod (IAsyncResult asyncResult)+42
System.Web.Mvc.Async.AsyncInvocationWithFilters.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3d() +72
System.Web.Mvc.Async.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f() +386
System.Web.Mvc.Async.AsyncControllerActionInvoker. EndInvokeActionMethodWithFilters (IAsyncResult asyncResult) +42
System.Web.Mvc.Async.<>c__DisplayClass2b.<BeginInvokeAction>b__1c() +38
System.Web.Mvc.Async.<>c__DisplayClass21.
<BeginInvokeAction>b__1e(IAsyncResult asyncResult) +186
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction (IAsyncResult asyncResult) +38
System.Web.Mvc.Controller.<BeginExecuteCore>b__1d(IAsyncResult asyncResult, ExecuteCoreState innerState) +29
System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +65
System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +53
System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +36
System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +38
System.Web.Mvc.MvcHandler.<BeginProcessRequest>b__5(IAsyncResult asyncResult, ProcessRequestState innerState) +44
System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +65
System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +38
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication. IExecutionStep.Execute() +399
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +157
I have looked at various solutions and articles, also tried solutions suggested by Leon on https://www.mathworks.com/matlabcentral/answers/29604-issues-with-iis-6-and-matlab-runtime and L. Mar in http://do-the-right-things.blogspot.com.au/2011/06/caveat-in-using-matlab-dll-in-aspnet.html
I also increased the server.scripttimeout in IIS but the same error message appears.
PS: Matlab is installed on server and dlls are created from same Matlab.
Update
So in case someone might got into same situation, I will explain how I resolved it so that it might save some time. This error is particularly related to mcrcachex.x (in my case mcrcache8.5 as I am using Matlab 2015a). When moving this folder from C:\Users\\AppData\Local\Temp\\ do not delete its contents as ".mcr_cache_index" has importance in it somehow. Before deleting, copy this file ".mcr_cache_index" somewhere safe and after creating MCR_CACHE_ROOT in environement variable and providing path to c:\mcrcahex.x, paste the ".mcr_cache_index" file that you saved for later use into this folder on c:\mcrcahex.x path. Later you can delete the mcrcachex.x from previous paths so that mcr wont look in these folders again on execution. Also provide access right permissions to it so compiler can create files in it.
First of all, this could very well be a rookie mistake on my part, I'm fairly new to .net and c#.
I'm using the CMS system Umbraco on our latest project, and a recent update has meant the system has started using the System.Globalization.CultureInfo class to deal with localization. This has resulted in multiple "Culture Not Found" errors in the CMS back office that renders it unusable. Here's a stack trace from one of them:
Server Error in '/' Application.
Culture is not supported.
Parameter name: name
.-no is an invalid culture identifier.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Globalization.CultureNotFoundException: Culture is not supported.
Parameter name: name
.-no is an invalid culture identifier.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[CultureNotFoundException: Culture is not supported.
Parameter name: name
.-no is an invalid culture identifier.]
System.Globalization.CultureInfo.GetCultureInfo(String name) +12488971
Umbraco.Core.Services.LocalizedTextServiceFileSources.<.ctor>b__0() +573
System.Lazy`1.CreateValue() +180
System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +26
System.Lazy`1.get_Value() +12446617
Umbraco.Core.Services.LocalizedTextServiceFileSources.TryConvert2LetterCultureTo4Letter(String twoLetterCulture) +61
Umbraco.Core.Services.LocalizedTextService.ConvertToSupportedCultureWithRegionCode(CultureInfo currentCulture) +110
Umbraco.Core.Services.LocalizedTextService.GetAllStoredValues(CultureInfo culture) +72
Umbraco.Web.Editors.BackOfficeController.LocalizedText(String culture) +123
lambda_method(Closure , ControllerBase , Object[] ) +77
System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) +14
System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +157
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +27
System.Web.Mvc.Async.AsyncControllerActionInvoker.<BeginInvokeSynchronousActionMethod>b__39(IAsyncResult asyncResult, ActionInvocation innerInvokeState) +22
System.Web.Mvc.Async.WrappedAsyncResult`2.CallEndDelegate(IAsyncResult asyncResult) +29
System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +49
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult) +32
System.Web.Mvc.Async.AsyncInvocationWithFilters.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3d() +50
System.Web.Mvc.Async.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f() +225
System.Web.Mvc.Async.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f() +225
System.Web.Mvc.Async.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f() +225
System.Web.Mvc.Async.<>c__DisplayClass33.<BeginInvokeActionMethodWithFilters>b__32(IAsyncResult asyncResult) +10
System.Web.Mvc.Async.WrappedAsyncResult`1.CallEndDelegate(IAsyncResult asyncResult) +10
System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +49
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult) +34
System.Web.Mvc.Async.<>c__DisplayClass2b.<BeginInvokeAction>b__1c() +26
System.Web.Mvc.Async.<>c__DisplayClass21.<BeginInvokeAction>b__1e(IAsyncResult asyncResult) +100
System.Web.Mvc.Async.WrappedAsyncResult`1.CallEndDelegate(IAsyncResult asyncResult) +10
System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +49
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +27
System.Web.Mvc.Controller.<BeginExecuteCore>b__1d(IAsyncResult asyncResult, ExecuteCoreState innerState) +13
System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +29
System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +49
System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +36
System.Web.Mvc.Controller.<BeginExecute>b__15(IAsyncResult asyncResult, Controller controller) +12
System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +22
System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +49
System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +26
System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult) +10
System.Web.Mvc.MvcHandler.<BeginProcessRequest>b__5(IAsyncResult asyncResult, ProcessRequestState innerState) +21
System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +29
System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +49
System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +28
System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +9765121
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155
I'm still not completely sure where the .-no is coming from, but after some amount of research into this I tried running the following code with a breakpoint inserted:
var locale = CultureInfo.GetCultures(CultureTypes.AllCultures & ~CultureTypes.NeutralCultures);
This returned null, and doesn't seem to be throwing an exception anywhere. I'm guessing this might be the cause of the errors, judging by the stack trace. Could this be an issue with my local setup? I'm running Windows 10, mainly in a virtualization environment, but it can also run natively via OSX Bootcamp, where the problem still seems to be present. I've also tried using Powershell to output the list of installed cultures, and that works fine.
If it helps, I'm using IISExpress for the web server and the database is running under SQL Server 2016 Express.
Thanks in advance! Let me know if I can supply any extra info to help out with this.
Make use of the fact that Umbraco is open source.
Judging from the stack trace and exception details you have provided, problem is caused by this line:
https://github.com/umbraco/Umbraco-CMS/blob/dev-v7/src/Umbraco.Core/Services/LocalizedTextServiceFileSources.cs#L102
Apparently invalid value .-no is passed into GetCultureInfo method. If you look a bit up in the source code, it seems that this value comes from XML file name or XML file content.
I cannot provide complete solution for your problem, but here are some things to try to pinpoint root cause of it:
1) Clean deployment folder
Do full clean & rebuild cycle
2) Check localization XML files to check if they contain valid cultures
If you have edited files manually, make sure there is no typo there.
3) Compare folders of "fresh" install and your non-working solution folder
Check if update hasn't left behind some XML files from previous versions;
I've been working on building an API for my company's website. I've got actions for all of my GETs working fine and returning JSON like I want.
I'm having problems when it comes to using POST to create new records though. I'm sending JSON to my controller. This works fine if my controller is accepting a string or object parameter, but doesn't work when it is expecting a Model.
Inside my api controller, I have this method:
[HttpPost]
public void POSTEstimate(Estimate estimate)
{
//never makes it to the first line when expecting a Model (Estimate)
}
From what I've been reading it looks like Web API should be able to deserialize the JSON that is posted automatically (and put it into my Model), but instead I always get a 500 Internal Server Error. The method works fine when I tell it to accept a string.
Is there something obvious I'm doing wrong here?
Edit: Here's the stack trace from the test page I'm using to call the API Method:
[WebException: The remote server returned an error: (500) Internal Server Error.]
System.Net.HttpWebRequest.GetResponse() +6120419
PDR.Controllers.AdminController.test() in c:\PDR\PDR\PDR\Controllers\AdminController.cs:714
lambda_method(Closure , ControllerBase , Object[] ) +96
System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) +17
System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +205
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +27
System.Web.Mvc.Async.<>c__DisplayClass42.<BeginInvokeSynchronousActionMethod>b__41() +28
System.Web.Mvc.Async.<>c__DisplayClass8`1.<BeginSynchronous>b__7(IAsyncResult _) +12
System.Web.Mvc.Async.WrappedAsyncResult`1.End() +57
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult) +50
System.Web.Mvc.Async.<>c__DisplayClass39.<BeginInvokeActionMethodWithFilters>b__33() +58
System.Web.Mvc.Async.<>c__DisplayClass4f.<InvokeActionMethodFilterAsynchronously>b__49() +237
System.Web.Mvc.Async.<>c__DisplayClass37.<BeginInvokeActionMethodWithFilters>b__36(IAsyncResult asyncResult) +12
System.Web.Mvc.Async.WrappedAsyncResult`1.End() +57
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult) +50
System.Web.Mvc.Async.<>c__DisplayClass2a.<BeginInvokeAction>b__20() +24
System.Web.Mvc.Async.<>c__DisplayClass25.<BeginInvokeAction>b__22(IAsyncResult asyncResult) +126
System.Web.Mvc.Async.WrappedAsyncResult`1.End() +57
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +45
System.Web.Mvc.<>c__DisplayClass1d.<BeginExecuteCore>b__18(IAsyncResult asyncResult) +14
System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +25
System.Web.Mvc.Async.WrappedAsyncResult`1.End() +62
System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +61
System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +25
System.Web.Mvc.Async.WrappedAsyncResult`1.End() +62
System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +49
System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult) +10
System.Web.Mvc.<>c__DisplayClass8.<BeginProcessRequest>b__3(IAsyncResult asyncResult) +28
System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +25
System.Web.Mvc.Async.WrappedAsyncResult`1.End() +62
System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +49
System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +9042109
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +184
Web API, like other REST frameworks, is encouraging and supporting using a POCO serializable to JSON DTO. The serialization seems to be failing.
Without the client code, which should be creating a properly formatted JSON body to POST, properly setting the content type being posted as application/json, it is hard to tell which part of the client code isn't correct.
The error being reported as an internal server error isn't helpful. The fact that your code isn't being reached, without even looking at the StackTrace, clearly indicates that the issue is occurring in framework code. The framework is expecting a properly formatted DTO, so compare the DTO being POST'd vs the DTO's definition OR construct and serialize an instance of the DTO and compare the actual strings.
I fell on something similar today, and my issue was that there were multiple possible actions in my controller that could be used by Web Api and it wasn't able to know which one to use. So in my case I used the longest form client-side and server-side for the action, instead of relying on default api route :
Router:
config.Routes.MapHttpRoute(
name: "ApiWithAction",
routeTemplate: "metadataApi/{controller}/{action}/{id}",
defaults: new {id = RouteParameter.Optional});
Ajax call:
[...]
var options = {
url: basePath + 'metadataapi/employee/FetchPage',
type: 'POST',
data: filter,
dataType: 'json'
};
return $.ajax(options);