I installed .net framework 4 on my windows 2003 enterprise x64, wrote simple asp.net 4.0 application (default.aspx page only). The application works great if request is to default.aspx, not to the root site:
contoso.com/ - doesn't work (Get 404 error)
contoso.com/default.aspx - works.
Default.aspx is in list of default documents in IIS.
Please help.
Found a fix in a seemingly unrelated location - try setting the "EnableExtensionlessUrls" registry key to 0:
ASP.NET 4 Breaking Changes -> ASP.NET 2.0 Applications Might Generate HttpException Errors that Reference eurl.axd:
In the Windows registry, open the following node:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ASP.NET\4.0.30319.0
Create a new DWORD value named EnableExtensionlessUrls.
Set EnableExtensionlessUrls to 0. This enables extensionless URL behavior.
Save the registry value and close the registry editor.
Run the iisreset command-line tool, which causes IIS to read the new registry value.
You will find the answer here
http://johan.driessen.se/archive/2010/04/13/getting-an-asp.net-4-application-to-work-on-iis6.aspx
.Net 4.0 doesn't enable itself to run with IIS so you have to run the command (while in the folder c:\windows\system32):
cscript iisext.vbs /EnFile C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll
or in your case since you are running x64
cscript iisext.vbs /EnFile C:\WINDOWS\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll
Change the ASp.Net Version from 4.0 to 2.0 and apply it. and revert back The Asp.Net version to 4.0. This Will address the issue.
I don't have enough points to comment apparently, but I wanted to say that the solution from Will WM worked for me. Adding EnableExtensionlessUrls to the registry corrected the problem.
As a side note, if your run aspnet_regiis at anytime, it will remove this value and you will need to add it again.
I use the following regex as first rule with Ionics Isapi Rewriter for web sites running on ASP.NET 4 on IIS 6 to remedy the problems caused by the breaking change introduced with ASP.NET 4 :
RewriteRule ^(.*)/eurl.axd/[a-f0-9]{32}(.*)$ $1$2
This let me again use extensionless urls.
Note that the second group captures the querystring if present and restitutes it to the rewritten url.
And yes, it's a feature, not a bug.
Are you sure it's default.aspx not default.asp in the list of default documents?
You will also get this error on ASP.NET 2.0 virtual directories in IIS6 if you have another virtual directory on the same site that is set to 4.0 and the DefaultWebSite is set to use ASP.NET 4.0.
The solution is to change the DefaultWebSite back to the ASP.NET 2.0. Your 4.0 virtual directory will still do fine underneath that web site.
Related
I'm trying to deploy a blazor app on IIS following the article below
https://learn.microsoft.com/en-us/aspnet/core/tutorials/publish-to-iis?view=aspnetcore-5.0&tabs=visual-studio
I've installed IIS version 10.0 using the following settings:
I then created the site and changed the application pool to No Managed Code
I created a new Blazor app and deployed it immediately without changing a thing (so I know there's not a problem with the code). Looking in the project properties it's using .NET Core 3.1
I noticed there was no web.config file when I built the Release version.
I copied the Release version to the website directory.
Browsing to the site gives me a 403.14 - Forbidden error.
I read in another article to try configuring the Mapping Handlers this was the current state of the handlers:
I added a module mapping like so:
I now get a 500 error:
The web.config file currently looks like this:
I then read to add this aspCore line to the configuration file:
After that it looks like it loads but with none of the formatting.
I assumed hosting a Blazor site on IIS would be a simple thing to do, would someone be able to point me to where I am going wrong?
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!
I have deployed an MVC 4 web-site to a Windows 2008 R2 server with IIS 7.5. .NET 4.5 is installed on the server.
The site works fine locally. All routing works fine. However, when I put it on the server, nothing works. I have confirmed that the DNS/binding is working by putting a static text file in the site and this works.
Here's a few things I've tried:
The default route / returns 403.13 - indicating directory browsing is disabled (correct). This should surely map to /home/index?
Any route (eg. /Organisation, Organisation/Index) simply returns 404.
Made sure all my DLLs are copied over (as per http://haacked.com/archive/2008/11/03/bin-deploy-aspnetmvc.aspx)
I have tried/confirmed:
HttpRedirection is installed on IIS7 (as per http://support.microsoft.com/kb/2023146)
HttpErrors is installed on IIS7
All my DLLs are in place
Am I missing something? My next act of desperation is to install the full ASP.NET MVC 4 stack including Visual Studio Express, SQL Express, etc. just to see if it works. Which I really don't want to do. This is a production server!
Update:
I should add that the same site works on en equivalent configuration in-house, on a staging server.
I had this same issue. There's a hotfix you should try:
http://support.microsoft.com/kb/980368
It fixed the issue for me.
I am trying to deploy a simple "Hello World" .NET 4.0 REST-style WCF service on WinXP (IIS5). It works fine in Cassini.
I tried to adapt the info here to me:
http://haacked.com/archive/2008/11/26/asp.net-mvc-on-iis-6-walkthrough.aspx
but something is not clicking. Can anyone lend ideas or comments? Yes, I must stay with WinXP.
Thanks.
After a fair amount of struggling I was able to successfully deploy a WCF 4.0 REST web service on XP/IIS5. For the benefit of you and others in the same situation, here's what I did (let me know if you need more detail):
Using VS 2010, build a deployment
package for the project and then
install it on the target machine
(your web server). The following
link will show you how to do this: http://vishaljoshi.blogspot.com/2009/03/web-packaging-installing-web-packages.html
Make sure that your virtual directory in IIS is configured to use .NET 4 (right click on virtual directory > properties > ASP.NET tab > ASP.NET Version)
Configure your virtual directory to support extensionless requests (i.e. your REST API) by creating a wildcard mapping (right click on virtual directory > properties > configuration > mappings tab) with the following properties:
Executable: C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll
Extension: .*
Check that file exists: unchecked
(Note: watch out for the bug that keeps the "OK" button on this dialog grayed out. To get around this just click in the executable textbox after entering your extension and the "OK" button should get enabled).
If you get an authentication error when accessing the service then turn off integrated authentication on the virtual directory. This should fix the problem if you have used the defaults in the generated web.config of your service. If you have explicitly modified the authentication mode then you will have to adapt accordingly.
Have you considered self-hosting your service instead of trying to use IIS. That will probably be easier to do than use IIS.
In case above steps dont work. There could be a problem with permissions on your App pool for that website / virtual directory , you can try to set that right and try it out.
You can refer this article for more help on this.
http://technicalwizardry.blogspot.in/2013/04/wcf-rest-service-hosted-on-iis-5.html#!/2013/04/wcf-rest-service-hosted-on-iis-5.html
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.