Webforms app runs fine in 2012 but not 2013 - visual-studio-2012

I have a Web forms application that runs fine in Visual Studio 2012 but when I run int in VS 2013 I get
System.SystemException occurred
Message: A first chance exception of type 'System.SystemException' occurred in mscorlib.dll
Additional information: The trust relationship between the primary domain and the trusted domain failed.
for a stacktrace when loading up the inital page. I am not sure where to start in trying to figure out what is causing the issue. Its running on the same framework version and has the same web config
Update .... I switch Visual Studio 2012 to use IIS Express and now get the same exception in VS 2012 and VS 2013. Now to resolve the exception ?
Any idea ?

This is because 2013 does not use cassini web server but instead uses IIS Express. This can happen in Visual Studio 2012 as well if you enable IIS Express instead of Cassini. To fix this follow these steps:
In visual studio click on your web project and then press F4
1) Anonymous Authentication needs to be disabled
2) Windows Authentication needs to be enabled
Note: if one of these are grayed out that means that you have a override in your IIS Express Config file which is located
\My Documents\IISExpress\config\applicationhost.config
Check for
<section name="anonymousAuthentication" overrideModeDefault="Allow"/>
or
<section name="windowsAuthentication" overrideModeDefault="Allow" />
More information:
http://msdn.microsoft.com/en-us/magazine/hh288080.aspx
http://www.codegorilla.com/2012/12/how-to-enable-windows-authentication-when-using-iisexpress/

From the error I'm making the assumption that you are using windows authentication..
You can get this error if you are calling isInRole and pass a role that doesn't exist..
HttpContext.Current.User.IsInRole("SomeMadeUpRole");
With regards to the difference between running in 2012 and 2013, 2013 uses IIS Express which is basically a cut down IIS 7.5 instead of 7...
Not 100% sure on this though, would be glad to hear if this helps!

Related

IIS Just in Time Popup

We had a classic ASP application that had to be migrated to a new Windows Server (Windows Server 2012 R2 Datacenter). IIS was already setup and we migrated the files configured the URL and DNS, as well as setting up the classic ASP components for IIS. The web application initially opens okay but the error below pops up on the server continually.
We checked the relevant site was configured to run 32bit and we ensured that in the sites "Debugging properties" the "Enable Server-side Debugging" was set to false. Also, all those testing the site we ensured in Internet Options >> Advanced the two values of "Disable script debugging" were checked. But this did not resolve the error. I believe we have all the necessary components setup in the server roles
I then followed this URL and deleted certain registry entries and restarted the server.
https://learn.microsoft.com/en-gb/visualstudio/debugger/just-in-time-debugging-in-visual-studio?view=vs-2015
This seemed to take away the above error but then the relevant application pool continually stops. I checked the application logs and at each time the application pool stops there is an error stating below
Since creating this ticket I installed DebugDiag 2 and set up a rule for IIS "Crashing". Ran the application until the relevant IIS Application Pool stopped and examined the Dump files created by the rule. All of them appear to have one error concerning "VCRUNTIME140.dll". See image below.
I found that this was a common issue and related to Visual C++ Redistributable 2015. I looked at installed programs and there was versions 2010, 2013 and 2017 installed. Microsoft state that after version 2013 subsequent versions incorporate the last. So I installed the latest version of Visual C++ Redistributable and restarted the server. This made no difference. So I uninstalled the latest version and installed version 2015 and restarted but again the application pool still stops after several actions on the web application.
Does anyone know how do I resolve this please?

ASP.NET Core 2.0 app targeting .NET 4.6.1 fails to host on IIS

The problem
IIS ASP.NET Core module is unable to start an ASP.NET Core 2.0 app.
Browser: HTTP Error 502.5 - Process Failure
Windows Event Log: Application ‘MACHINE/WEBROOT/APPHOST/AppSite’ with physical root ‘C:\inetpub\apps\AppFolder\’ failed to start process with commandline ‘C:\inetpub\apps\AppFolder\App.exe’, ErrorCode = ‘0x80004005: 1’.
ASP.NET Core Module Log: Log file is created but is empty.
The setup
App: ASP.NET Core 2.0 targeting .NET Framework 4.6.1.
Server: Windows Server 2012 R2 Standard 6.2.9200 with IIS 8.5.9600.
The story
We've created a blank MVC Web application using the default project templates provided in Visual Studio 2017.
The app is deployed following the official specification: https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/iis/.
The confusion arises mainly from these two points:
Running the app through command-line on Kestrel works.
Running a different app but targeting .NET Core 2.0 and publishing as framework-dependant works flawlessly on IIS.
But between these two apps: the codebase is the same, the IIS website and application pool is the same and we even emptied out the app directory and used the same one.
Due to these points the only difference seems to be the net461 app's executable file.
We do not have full control over the Windows Server where we're trying to deploy but we do have administrator accounts. The current assumption is that the issue lies within permissions - maybe AD group policies, antivirus blocking the file but we're still awaiting response from the client's sysadmins. Meanwhile we haven't been able to replicate the error code ‘0x80004005: 1’ while trying to setup these restrictions on our development machines.
Here's an incomplete list of ideas and points about the issue we've tried while problem solving:
The initial app (targeting net461) works flawlessly on IIS when
deployed to other servers (Windows 10 Enterprise, Windows Server 2012
R2 Datacenter).
Reinstalling different versions of ASP.NET Core/.NET Core: Runtime & Hosting Bundle.
Setting NTFS permissions to the dotnet folder.
Changing IIS application pool identity to an administrator account.
Restarting the server.
Going over local group and security policies.
Going over the antivirus settings and logs.
Trying to deploy on a brand new server (same OS, same bloat).
All ideas/comments are greatly appreciated. The more obscure the better.
EDIT:
Since this got flagged as a possible duplicate of ASP.NET Core 0x80004005 I need to specify why that is not a duplicate.
That referenced project is an older version of ASP.NET Core (last use
of project.json was in 2016)
That referenced project targets .NET Core and not .NET 4.6.1. It is mentioned here as well that targeting .NET Core works on IIS in regard to this issue.
Selected answer points out that they fixed it by:
Turns out that this was result of needing to install some windows
updates and this problem:
api-ms-win-crt-runtime-l1-1-0.dll is missing when opening Microsoft
Office file
Rather than install the version discussed in the above issue I whet
into Programs and Features and ran a repair on Microsoft Visual C++
2015 Redistributable.
but the installation of Microsoft Visual C++ 2015 Redistributable is one of the steps in the official setup guide and it is mentioned here as well that the official guide has been followed during the setup process.
We have gone over that post and tried to repair and reinstall the Microsoft Visual C++ 2015 Redistributable runtime components and this did not fix the issue.
If anyone stumbles upon this post in the future:
The problem was indeed in the server's antivirus. It wasn't directly blocking the app's executable but its call to a class library in the system folder. This termination did not raise any of the usual alarms.
The application "C:\inetpub\apps\AppFolder\App.exe" attempted to load the library "bcrypt.dll" by calling the function "LoadLibraryExW". The operation was blocked and the application terminated.
After switching the MVC blank app to a completely blank Hello-World app it ran successfully.

Where to get Visual Studio LightSwitch 2012 Server Runtime from in Web Platform Installer?

I have upgraded my 2011 Lightswitch app to 2012 RTM and it works fine locally. However, when I try to Publish it to my web server it fails (http://blogs.msdn.com/b/bethmassi/archive/2011/03/23/deployment-guide-how-to-configure-a-web-server-to-host-lightswitch-applications.aspx).
I checked the Web Platform Installer on the live server and it does NOT have "Visual Studio LightSwitch 2012 Server Runtime without Local SQL" (http://msdn.microsoft.com/en-us/library/Gg481779(v=vs.110).aspx) - it only has the 2011 version.
Where do I get the 2012 version from? There is very little info about it on the web.
Ok, I am going to summarise my experience here as it might help others who are upgrading. My app uses the Telerik RadgridView control and Forms authentication. It runs OOB:
1) Firstly, I upgraded to the RTM LS2012 version and rebuild my app - all works fine on Dev.
2) I then tried to deploy to my Win2008 Server with no changes (note: it was running the LS2011 version with no problems). This failed with an "Unknown" message during the publish process. To get around this I unchecked the flag on the Publish wizard "IIS Server has the Lightswitch Deployment Prerequisites".
3) Next problem: The Silverlight App would show "loading" and then show a blank screen. At one point I received a message saying "Debugging resource strings are unavailable". The problem here was that the IIS site that the publishing wizard created had Windows and Forms Authentication (under the IIS Authentication icon). Disabling Windows Auth solved this problem. I was finally able to log on to my app.
4) Hardest problem: The app would log in and work fine for about 20 seconds. Then it would throw a Silverlight unhandled exception: "Unhandled exception at 0x5ceed700 in sllauncher.exe: 0xC0000 094: Integer division by zero". After a lot of Googling someone asked if I was using a VM - the server IS a VM and they suggested I run as a single processor (ie. it was a threading error). I did not try this, instead I tried running from a different PC as a client OOB (I was testing on the server). This then worked.
After all this my app is now up and running as Lightswitch 2012.... hope this helps someone!
Notes: I did NOT install .NET 4.5 (my projects target .NET 4) OR the Lightswitch 2012 requisites on the server. It works with the Silverlight 4 Telerik dlls.
I think all you need is change of .NET framework from 4.0 to 4.5 in your application directory.
It is called "LightSwitch for Visual Studio 2012 - Server Configuration with(out) local SQL Express" and available at the Web Platform Installer.

Crystal Reports 2010 in IIS 7.5 asking for authentication

We're in the process of moving from 2003 IIS6 Web servers to 2008 R2 with IIS 7.5.
We also have a Windows 2008 server running IIS7 and everything works fine on this server.
On the new servers when we go to our crystal reports viewer page we get prompted for windows authentication, then if you type in valid credentials or not you get the following error in firefox:
XML Parsing Error: no element found
Location: http://192.168.10.112/Reports/ReportViewer.aspx?id=49
Line Number 1, Column 1:
^
In IE you just get a blank screen.
The same code runs fine in debug mode on the server in Visual Studio 2010, and works fine on our other servers
Thanks
I know that the answer is too late, but to be a reference for other users.
I faced this problem too in IIS 7.5, and after 5 days investigation, I found that the problem is because the Crystal Reports Viewer running as 32-bit, to solve this issue:
in IIS, go to Application Pools
Select pool that you are using it for your application, normally its "ASP.Net v4.0".
Click on "Advanced Setting..." in the right panel.
set the value "Enable 32-bit Application" to "True"
Also, note that you have to install the oracle client 32-bit version too.

HTTP Error 404.3-Not Found in IIS 7.5

I'm using IIS 7.5 on Windows Server 2008 R2 x64 Enterprise Edition. In the project we have developed with ASP.NET 4.0 we used WCF Service. But it doesn't run over domain when the software is running from local computer. Otherwise, I am getting the following error:
HTTP Error 404.3-Not Found
The page you are requesting cannot be served because of the extension
configuration. If the page is script, add a handler. If the file should
be downloaded, add a MIME map.
You should install IIS sub components from
Control Panel -> Programs and Features -> Turn Windows features on or off
Internet Information Services has subsection World Wide Web Services / Application Development Features
There you must check ASP.NET (.NET Extensibility, ISAPI Extensions, ISAPI Filters will be selected automatically). Double check that specific versions are checked. Under Windows Server 2012 R2, these options are split into 4 & 4.5.
Run from cmd:
%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis.exe -ir
Finally check in IIS manager, that your application uses application pool with .NET framework version v4.0.
Also, look at this answer.
In my case, along with Mekanik's suggestions, I was receiving this error in Windows Server 2012 and I had to tick "HTTP Activation" in "Add Role Services".
In windows server 2012, even after installing asp.net you might run into this issue.
Check for "Http activation" feature. This feature is present under Web services as well.
Make sure you add the above and everything should be awesome for you !!!
I was having trouble accessing wcf service hosted locally in IIS. Running aspnet_regiis.exe -i wasn't working.
However, I fortunately came across the following:
Rahul's blog
which informs that servicemodelreg also needs to be run:
Run Visual Studio 2008 Command Prompt as “Administrator”.
Navigate to C:\Windows\Microsoft.NET\Framework\v3.0\Windows Communication Foundation.
Run this command servicemodelreg –i.

Resources