I have an ASP.NET MVC application configured for Portuguese, on Visual Studio 2015. While debugging this application, I've set <customErrors mode="Off" />, but all errors are shown in Portuguese, and I want to see them in English.
I tried to set this in Web.config:
<globalization uiCulture="en-US" culture="en-US" enableClientBasedCulture="true" />
In Global.asax I tried:
Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo("en-US");
Thread.CurrentThread.CurrentCulture = CultureInfo.GetCultureInfo("en-US");
and
Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
Thread.CurrentThread.CurrentUICulture = CultureInfo.InvariantCulture;
I also uninstalled the Nuget package Microsoft.AspNet.Mvc.pt-br, no success.
This question is similar, but I need a solution that doesn't involve changing the machine's configuration or installed components, as that's not allowed in my workplace.
How can I make all error messages show in a specific language (in this case, English)?
Today when I tried this again, to my surprise the messages were in English (almost, see below). I tried to reproduce the error I had yesterday, but I couldn't.
Perhaps it is just a matter of restarting (VS or the PC). I also kept working on the project at night on a different PC, but not on anything related with this issue, so I can't say it made a difference. All I have set up in Web.config is:
<globalization uiCulture="en-US" culture="en-US" enableClientBasedCulture="true" />
But still not everything was in English. While trying to reproduce the error, I forced a library load error, I used a DLL that requires Ninject to be installed. The error message was (emphasis mine on the translated part):
Server Error in '/' Application.
Could not load file or assembly 'Ninject, Version=3.2.0.0, Culture=neutral, PublicKeyToken=c7192dc5380945e7' or one of its dependencies. O sistema não pode encontrar o arquivo especificado.
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.
That part was supposed to be: The system cannot find the file specified.
In that case, I don't think there is much that can be done programmatically only.
Uninstall the .net framework in the portugese version and reinstall the english version, that should do the trick.
Related
There is a webservice project written in VS2010 few years ago and the problem is all code exactly same (same PC , Tested with vs2010 and 2015 with the same code) but in vs2015 it gives error on debug mode. Options > "Projects & Solutions" settings are all same. I took this error and definition of it;
An unhandled exception of type 'System.StackOverflowException' occurred in System.Runtime.Serialization.dll
System.StackOverflowException was unhandled Message: An unhandled exception of type 'System.StackOverflowException' occurred in mscorlib.dll
Anyone have idea about it , I'm really glad to attention. I could't share code because it's nearly 30.000 lines.
SOLVED
Add this to the appSettings in your web.config:
<add key="vs:EnableBrowserLink" value="false" />
After VS 2013, by default VS automatically enables Browser Link. The StackOverflowException occurs, but doesn't include any details of what happened. You can check this link for more information about the browser link feature in VS 2013: https://blogs.msdn.microsoft.com/webdev/2013/06/28/browser-link-feature-in-visual-studio-preview-2013/
You got this error, what you gonna do ....
Your project stops and not working, but that is usually not about your code.
Of course, that depends how you coding but if you didn’t write any infinite loop than its completely fine.
It’s about Visual Studio 2013, it tries to send long serialized data to browser because of “enable browser link” option.
You can fix this issue by two ways..
Add this in appSettings in your web.config
<add key="vs:EnableBrowserLink" value="false" />
Or
You can disable following option in tool menu
I use ASP.NET, EF 6.0.2, MVC 5.1.1.
In web.config I set culture and uiCulture:
<system.web>
<globalization culture="de-CH" uiCulture="de" enableClientBasedCulture="false" />
</system.web>
When I run the application locally, then the validation messages are shown in German correctly.
When I publish the project to the webserver, the validation message are shown always in English.
But the printing of:
Culture: #System.Threading.Thread.CurrentThread.CurrentCulture.ToString()
UI Culture: #System.Threading.Thread.CurrentThread.CurrentUICulture.ToString()
shows correct the setted 'de-CH' and 'de'...
The validation takes place on the server instead (not client side). Because the validation message after submitting the form occurs
What I want, is to set the language of the application fix to German-Switzerland.
The problem was solved: The German language pack was not installed on the server.
An ASP.NET/C# project which I created in 2003 has been running on a university server for over 10 years now but I was just informed that the server crashed and they are trying to set everything up again.
They are getting the following error.
I see that at the bottom it seems that they have installed Mono on a Debian machine. Could it be that they installed Mono but forgot to install the C# compiler, or does this message imply something else is wrong?
What could be the cause and solution to this error?
According to the BuildManager code in Mono:
if (configSection == null)
config = WebConfigurationManager.GetWebApplicationSection ("system.web/compilation") as CompilationSection;
else
config = configSection;
...
if (throwOnMissing)
throw new HttpException (String.Concat ("No compiler for language '", language, "'."));
It's apparently not finding the compilation section for C# in the configuration. Have you checked the machine.config or web.config? e.g.
<system.web>
<compilation defaultLanguage="C#">
<compilers>
You should have a .NET compiler configuration here.
</compilers>
</compilation>
</system.web>
Check out this page for more information.
it could be also an decode error because he can identify '\C#\' try to use dos2unix rekursivly over your directory
We just recently upgraded from VS2008 to VS2010.
Our project compiles fine; but when we go to run the Web Application, we get the following error when opening Default.aspx:
Server Error in '/' Application.
Compilation Error Description: An
error occurred during the compilation
of a resource required to service this
request. Please review the following
specific error details and modify your
source code appropriately.
Compiler Error Message: CS0246: The
type or namespace name 'var' could not
be found (are you missing a using
directive or an assembly reference?)
Opening up the page, and mousing over the 'var' declaration, VS2010 correctly recognizes that it's type is a RegEx.
I'm thinking something funky might have happened in either our web.config or machine.config during the upgrade.
Anybody else run into this problem before? Any help would be greatly appreciated, hopefully it can save me some time diving into these files.
EDIT:
Here's the relevent section of code that's blowing up:
Line 10: protected void valSearchFreeText_ServerValidate(object source, ServerValidateEventArgs args)
Line 11: {
Line 12: var url = new Regex(#"http(s)?://([\w-]+\.)+[\w-]+(/[\w- ./?%&=]*)?", RegexOptions.IgnoreCase);
Line 13: var html = new Regex(#"[<,>]", RegexOptions.IgnoreCase);
Line 14: args.IsValid = !html.IsMatch(args.Value) && !url.IsMatch(args.Value);
I don't believe that .NET 4.0 is the cause; we only upgraded from VS2008 to VS2010; we did not migrate from .NET 3.5 to .NET 4.0
I will double check on the ASP.NET Development Server vs. IIS and post back in a few minutes with the results from that. It's definitely being thrown from the Development Server.
Edit 2
This is being thrown from both the Development Server, and IIS.
System.Xml.Linq is also included in the assemblies section of our web.config:
<add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
Check your web.config file for the configuration/system.codedom/compilers/compiler node. There should be a providerOption child node that determines the compiler version to be used. It ought to look like <providerOption name="CompilerVersion" value="v3.5"/>. It sounds like yours says 2.0 instead of 3.5.
Is the associated application pool in IIS set to use the .Net 4 framework?
Ensure that the target framework is set to 3.5 or higher
Also, double check that you have a good web.config file in the Application root folder (copy the recommended web.config and rename it.)
I have an ASP.NET 3.5 web application which works perfectly fine on my local machine and when I deploy it on my Windows 2008 server. I am getting the following javascript error:
Message: Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The status code returned from the server was: 500
Line: 4723
Char: 21
Code: 0
URI: http://localhost/ScriptResource.axd?d=e1Gld4LGHLsC4rWqevEI8zAMJKoVcCEVHBjdJIxcQLO9of6t7nNopbI1YyxJTv1QbaxN_lTSoz5Ly-VjBRHp08Mf3xxg5V9i5Z0AiXIkZRY1&t=6af1de90
I have a utility which can decrypt the URI and tell exactly what file is missing and it tunrns out that the file is ZSystem.Web.Extensions,3.5.0.0,,31bf3856ad364e35|MicrosoftAjax.debug.js|. Why am I not able to load this js file? Any help?
Possible options:
You've not installed .NET Framework SP1 on your server, so it can't find the 3.5 assemblies to generate the MsAjax file.
You've deployed your web.config file with <compilation debug="true"> while IIS has been configured to compile it in release mode.
I have run into a similar problem before when the development and production machines are set for two different time zones. When ASP.NET AJAX tries to load a script resource from an assembly, the last modified date/time of the assembly is validated. If the local time of the production server is "earlier" than the last modified date/time of the assembly, then an ArgumentOutOfRange exception is generated by ASP.NET AJAX when processing the request.
Really difficult to debug since the problem eventually resolves itself.
I suppose this might be possible with a System assembly if Copy-Local is set to true.
I was using some third party web services and the problem was with the following xml tag in the web.config:
<extendedProtectionPolicy policyEnforcement="Never" />
Once I removed this tag the error went away