Deploying MVC 4 application on IIS 7.5 Error HTTP 500.19 - asp.net-mvc-4

I am trying to deploy my asp.net mvc4 web app on IIS 7.5 under Windows 7 professional.
I have copied all the necessary files using publish method from Visual Studio 2010 express into folder D:\IIS\MyWebsite
This folder contains the typical structue MVC 4: folders App_Data, Content, Images, Views, Controllers, bin, App_GlobalResources, Scripts and some files at root like: Global.asax, Web.config.
I create a website with a name, let's me say as an example, MyFirstMVC on port 81 and associated to a custom app pool, let's say, MyAppPool (using ApplicationPoolIdentity) which is in integrated mode and using NET Framework 4 as my web app is developed in NET Framework 4.
When I run it below error is raised:
Error HTTP 500.19 - Internal Server Error
and above the example I can see in configuration source section below messages:
49: <modules runAllManagedModulesForAllRequests="true" />
50: <handlers>
51: <remove name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" />
I have tried to add IIS_IUSRS to my root folder 'MyWebsite' and give it full control permissions but it does not work. I have tried some things discussed here:
How do I resolve "HTTP Error 500.19 - Internal Server Error" on IIS7.0
Also I have observed that once opened inetmgr when I select the root node of the Connection tree on the left, then in the panel on the right, there is no ASP.NET group, only IIS and management so I am not sure it is normal, maybe is there something wrong with ASP.NET¿?
SOLUTION:
Finally, I have solved it by running following command as in internet information services ASP.NET was missed:
%windir%\Windows\Microsoft.NET\Framework64\v2.0.50727\aspnet_regiis.exe -i
%windir%\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis.exe -i
in my case the path is pointing to Framework64 because I am running on a Windows 7 professional x86_64.

I had same issue. MVC4 application with IIS7 under VS 2012 (windows 7 with 64 bit).I solved the issue with below command.
Run -> CMD (administration mode)
C:\Windows\Microsoft.NET\Framework64\v4.0.30319>aspnet_regiis.exe -i

I had a similar situation but was receiving a 404 error. I'm running VS 4.5, IIS 7.5 and the website is MVC 4.5. I ran only the one line above which resolved my problem as well. thanks!
%windir%\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis.exe -i
NOTE: i figured it was something like this since I received an error when trying to review ".NET Complication" within the webapp of IIS.

Related

Deploying Asp.net Core 3.1 does not work on Windows server

I have this Asp.net Core 3.1 developed on VS2019 preview.
basically it is a blazor server-side app with referenced assemblies and some nugets.
it runs fine on VS2019 and on my IIS after publishing to folder..
problem is when i move that folder to windows server machine with IIS installed and everything.
an error with 500 code appears.
one thing i noticed here..the log_error.txt file in the server it points out an exception
,and that exception -what ever it is- showing the error line of the startup.cs file with my laptop directory path !
i mean it shows this C:/mrmeeez/..../Startup.cs line 411
but this path does not exists in the windows server machine
it supposed to be F:/.... somthing/Startup.cs line 411
i don't know if it has something too do with the problem anyway..or maybe my assemblies and nugets not shipping correctly to the server
windows server machine is working fine , i tried blazor app template and it ran perfectly.
i need your help guys , Thanks !
Ok , i found it
i don't know for sure is this related to asp.net core 3.1
because i deployed asp.net core 2.1 months ago and it was fine
anyway i used the development exception page in the final publish to see what causing the error and showed this
UnauthorizedAccessException: Access to the path 'C:\Windows\system32\config\systemprofile\AppData\Local\ASP.NET\DataProtection-Keys' is denied.
and after searching for that i found the answer from a guy in github
it seems that the user IIS_IUSRS for this application pool -by default- does not have permissions to access that path
to solve this problem,either one of the two below:
1-Give IIS_IUSRS permissions to access the system files -NOT RECOMANDED-
2-Change the user of the your application pool to LocalSystem account in IIS by going to Application Pools -> Right-Click your app -> Advance Settings -> Process Model section then change Identity
Reference: https://github.com/dotnet/aspnetcore/issues/1983
Thanks!

'Bad Gateway' error when loading aspnetcore RC2 default website project

I am attempting to run the default ASP.NET Core Web Application (Web Application Template in VS 2015) via IIS.
I have followed the instructions from the docs here eg setting up a 'No Managed Code' application pool and pointing the Physical Path at the location of the web.config file.
When I attempt to browse to the website root, http://localhost I am getting this error:
HTTP Error 502.3 - Bad Gateway There was a connection error while trying to route the request.
Most likely causes: The CGI application did not return a valid set of
HTTP errors. A server acting as a proxy or gateway was unable to
process the request due to an error in a parent gateway.
The event viewer states:
Failed to start process with commandline 'dotnet ./bin/Debug/netcoreapp1.0/WebApplication2.dll', Error Code = '0x80004005'.
This error shows I have replaced the placeholders
<aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%"
in web.config with the required values
<aspNetCore processPath="dotnet" arguments="./bin/Debug/netcoreapp1.0/WebApplication2.dll"
(update: these placeholders are replaced when you publish)
As per the troubleshooting instructions I have installed .NET Core Windows Server Hosting Bundle and restarted the server.
Running from the command line via dotnet works
Wondering what to try now.
Ok I figured my issue out. I am pointing the physical path in IIS to the unpublished Visual Studio project root directory. This works in previous versions of .net (ie non dotnet core aspnet projects) but doesnt now.
If you really want this to work then you have to publish your app to a temporary folder and copy the Microsoft.AspNetCore.* binaries back into the bin\Debug\ folder along with the refs and runtimes folders
This is a generic error for when IIS can't find the specified .NET Core components ,and doesn't know where to forward requests. In addition to following the official IIS publishing guide, make sure you have:
Installed the correct versions from the download page for latest .NET Core releases
Specified the correct library versions (explicitly or with wildcards) in your project.json
Included a web.config file (preferably using the publish-iis tool), and that the <aspNetCore> key values have been replaced with local values (source, with examples)
I ran into this while setting up a Core 1.0.0 (final) website on a new Windows 2008 Server. Turns out I had mixed up some of the installers from my dev machine with newer versions, and had mismatched library versions (RC2 vs final). Reinstalling the Server Hosting package fixed the problem.
The key to troubleshooting was to get into the console and use the dotnet commands (and resulting error messages) to iterate until I had my site running from the console, since the IIS error page in the browser was useless. I also found some benefit in a few entries in the system Error logs, but not much.

Silverlight 4 WCF Ria Services 404 Error

My Silverlight 4 WCF RIA Services Project works fine on my dev machine from VS 2010 also published, from IIS. But when I deploy it to the client machine (windows7) all my service methods return NotFound error. I tried all blog posts and forums all day long but in vain. service url from fiddler returns on the dev machine but 404 on the client pc. I am so frustrated right now. In my last trial I saw about manual creation of physical .svc file
<%# ServiceHost Service="Fully.Qualified.NameOfYourService" Factory="System.ServiceModel.DomainServices.Hosting.DomainServiceHostFactory" %>
But couldn't figure out how to implement, someone please save my future??
install .NET framework 4.0;
install IIS7 and enable "Windows Communication Foundation HTTP Activation" in the "Windows features";
install WCF RIA Services with the option "SERVER=true" (you could also skip this step setting "Copy Local=True" for the System.ServiceModel.DomainServices.* dlls stored in the bin folder of your web application);
msiexec /i RIAServices.msi SERVER=true
use the "Add Application" menu in "IIS Manager" specifying the application name, the deploy dir containing your app and "ASP.NET v4.0" as application pool;
if you obtain a "404 error" it's also useful to run "aspnet_regiis.exe -i" from the "C:\Windows\Microsoft.NET\Framework\v4.0.30319" directory;
simple, create a new web site [to host your application] and then run the "aspnet_regiis -i" from the framework folder [Framework for 32bit or Framework64 for 64bit applications].
When viewing the HTTP Handlers section under the new website and you will see the various mappings for the .svc files have been created [look back at the default website and these havent been upgraded!]. This then resolved the 404 errors and Fiddler was also confirming that the svc files were being accessed correctly.
As a last configuration make sure the application pool is set to the ASP.NET 4 Integrated mode pool and enable the allow 32bit applications.
Hope this helps :-)

HTTP Error 404.3 - Not Found" while browsing wcf service on Windows Server 2008(64bit)

I am developing an application based on .Net Framework 3.5 sp1 and hosted on windows server 2008(64bit).
While browsing wcf service (.svc) locally every things is ok but while browsing with full domain URL, it got an error.
local address is like this: http://localhost/MyService.svc
and domain address is like this: http://MySite.ir/MyService.svc
by the way pages (.aspx) and other files work correctly both on localhost and with domain address.
any Idea would be appreciated
Here is detailed error:
HTTP Error 404.3 - Not Found
The page you are requesting cannot be served because of the extension configuration. If the page is a script, add a handler. If the file should be downloaded, add a MIME map.
Detailed Error Information
Module: StaticFileModule
Notification: ExecuteRequestHandler
Handler: StaticFile
Error Code: 0x80070032
Requested URL: http://MySite.ir:80/MyService.svc
Physical Path: D:\inetpub\vhosts\MySite.ir\httpdocs\MyService.svc
Logon Method: Anonymous
Logon User Anonymous
Please make sure you've activated WCF components from here.
Or alternate and easy way is, go to control panel -> Turn Windows feature on or off -> and make sure you've all the options ticked as mentioned in below screenshot.
You might need to activate each box and accept in case you get errors when activating all features at once
OK, here is the answer:
Go to Handler Mappings | Add Handler Manager --> And then add below information
Request Path: *.svc
Type: System.ServiceModel.Activation.HttpHandler, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Name: svc-Integrated
If anyone has this issue on Windows Server 2012, Bill Moon's answer here solved it for me:
"For Windows Server 2012... From the Server Manager, click on Add roles and features, select the appropriate server, then select Features. Under .NET Framework 4.5 Features, you'll see WCF Services, and under that, you'll find HTTP Activation."
I have windows 10 in my laptop and using visual studio 2015 for WCF development. WCF is running fine in visual studio but when hosted in IIS I got the same error.
I checked IIS handler. svc extension was missing. So I tried to add new handler in IIS as suggested by Mori in first answer. I didn't find type "System.ServiceModel.Activation.HttpHandler".
So I opened "Turn windows features On or Off" and installed features as highlighted in screen shot.
This worked for me.
If you're using .Net 4.x, the PublicKeyToken is 31bf3856ad364e35.
However, following this post about installing WCF Services properly in IIS, the handler was set up for me.
I wanted to add this as a comment to the answer but didn't have enough rep for it. I tried running ServiceModelReg and aspnet_regiis.exe with various flags and added HTTP Activation feature but it still didn't work. Even using the Handler mapping UI in IIS didn't work since it could not find System.ServiceModel.Activation.HttpHandler. What finally worked was adding the handler Mori mentions manually to my web.config file.
<system.webServer>
<handlers>
<add name="svc-Integrated" path="*.svc" verb="GET,HEAD,POST,DEBUG" type="System.ServiceModel.Activation.HttpHandler, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" modules="ManagedPipelineHandler" scriptProcessor="" resourceType="Unspecified" requireAccess="Script" allowPathInfo="false" preCondition="integratedMode" responseBufferLimit="4194304" />
My project was running .Net 3.5 and IIS 7.5 on Windows 7 and IIS 7.0 on Win Server 2008 R2.
Try unchecking WCF HTTP activations from "Turn Windows featured on or off" window (See here) and re-install by going to
%windir%\Microsoft.Net\Framework\v3.0\Windows Communication Foundation\
and execute ServiceModelReg -i

WCF 4 Router Service configuration issue

I've created a WCF 4 Router Service and am hosting it in IIS7. It works fine on my development machine, but when I deploy to the QA server is returns the following message:
The configuration section 'routing' cannot be read because it is missing a section declaration
The section it's complaining about is the standard WCF4 routing section:
<routing>
<filters>
<filter name="MatchAllFilter1" filterType="MatchAll" />
</filters>
<filterTables>
<filterTable name="ServiceRouterTable">
<add filterName="MatchAllFilter1" endpointName="WCF_XXXService" />
</filterTable>
</filterTables>
</routing>
This should be stock standard, but I'm receiving the above error from IIS. Does anyone have any suggestions on how I can fix this issue?
Ok, finally found the solution here:
The root configuration files (the
machine.config file and the root
Web.config file) for the .NET
Framework 4 (and therefore ASP.NET 4)
have been updated to include most of
the boilerplate configuration
information that in ASP.NET 3.5 was
found in the application Web.config
files. Because of the complexity of
the managed IIS 7 and IIS 7.5
configuration systems, running ASP.NET
3.5 applications under ASP.NET 4 and under IIS 7 and IIS 7.5 can result in
either ASP.NET or IIS configuration
errors.
We recommend that you upgrade ASP.NET
3.5 applications to ASP.NET 4 by using the project upgrade tools in Visual
Studio 2010, if practical. Visual
Studio 2010 automatically modifies the
ASP.NET 3.5 application's Web.config
file to contain the appropriate
settings for ASP.NET 4.
READ MORE HERE:
aspnet4 breaking-changes
A quick Google turned up this:
If you upgrade a site to .NET 4, and don’t upgrade the application pool to use .NET 4, you will get this. The machine.config file for .NET 4 declares this section, and earlier version did not have it (unless you manually added it).
In IIS 7, with the site select, choose Basic Settings in the right pane. This will bring up a dialog that contains the name of your application pool. Then select the application pools tree node and the application pool from the list that shows up. Choose Basic Settings from the right pane here, and you can change the framework version.
From here
Can you try re-running aspnet_regiis from the FrameworkXXX\microsoft.net\v4.0.30319 folder and reset IIS?
Check the .Net framework associated with the site's app pool.
If you need to change it, run iisreset -force after to ensure changes take effect.