XML Parsing Error: no root element found in iis - asp.net

I am very new to web services. I have wrote a web service application. When I run it from visual studio, everything works fine and my local website comes up. But after I deployed it in IIS, I can't browse it from iis and i get the following error! I am confused about this error for a day! Can some one help me?
XML Parsing Error: no root element found
Location: http://localhost:99/WebService.asmx
Line Number 1, Column 1:

I faced a similar issue when I deployed a project on my local new computer. By default, ASP.NET is installed but disabled in Windows.I had to enable it before my project run. See Install IIS and ASP.NET Modules for details.
Make sure that all the required modules are enabled.

I had same issue, but had ASP.NET modules installed. Apparently had to change .NET Framework Version from v2.0 to v4.0 and site was showing as it should. You need to go to IIS, Application Pools, double click the one that has older version of .NET and set the relevant one. Maybe this will be helpful for someone else.

Related

How to add Default.aspx as default document

I have a new Windows Server 2016 with IIS 10.0.
I have a ASP.NET 4.6.2 application with a Default.aspx file.
When I point my browser to the application I get this error:
HTTP Error 403.14 - Forbidden
The Web server is configured to not list the contents of this directory.
I suspect that IIS is not configured for ASP.NET because the Default Document does not include Default.aspx.
I have .Net Framework 4.6.2 as evidenced that I get an error message that is is already installed when I try to install it again.
The application pool lists CLR 4.0, but does not allow me to change it to 4.6.2.
What do I try to get this configured to load my Default.aspx.
When I google I stumble on things that tell me to run stuff from the command line. I am perfectly comfortable running things from the command line but what I am doing is do vanilla that I can't believe I need to do something from the commandline.
[EDIT] Here is what happened when I added Default.aspx as a default document:
There are a few things to try, but all the instructions are a bit to vague for me to follow with confidence. It also seems weird that I would have to run a commandline thing for something so common as getting IIS to use ASP.NET.
[EDIT] Here are the settings for the Default page:
[EDIT] Here is the configuration of the Application Pool:
After going down all kinds of wrong paths I found this link:
https://learn.microsoft.com/en-us/iis/get-started/whats-new-in-iis-8/iis-80-using-aspnet-35-and-aspnet-45
which amounted to getting 4.6 checked on this wizard screen and pressing install. It was confusing because this is under the development category and this is not a development machine.
Note: the hand added Default.aspx caused a conflict so I had to remove it from web.config by hand.
you can see below link where you can find your answer.
https://www.c-sharpcorner.com/UploadFile/francissvk/set-default-page-for-a-website-in-iis421/

"There was an error while performing this operation"

I have a website in IIS for which I cannot open any of the settings like Authentication, Handler Mappings, Authorization Rules etc. It just shows the error message "There was an error while performing this operation", with no more details and points to web.config.
Browsing the website results in a 500.19 error.
I tried adding iis_iusrs to the website folder and web.config, changing the app pool identity giving access to same on web.config/website folder security settings, verified target framework, iisreset/app pool recycles to no avail.
It turned out the website was using URL rewrite module which i was missing.
Downloaded web platform installer from MS and installed URL rewrite module.
http://www.microsoft.com/web/downloads/platform.aspx
Wish IIS errors were more informative than just "There was an error..."
I am running IIS 8.5 and I deployed my first Asp.Net Core 2.0 (Razor pages) site to the IIS Server (on Windows Server 2012 R2) that was running several Asp.Net Framework/Classic websites. This worked for me:
Install the .NET Core Windows Server Hosting bundle
https://learn.microsoft.com/en-us/aspnet/core/publishing/iis?tabs=aspnetcore2x#install-the-net-core-windows-server-hosting-bundle
It turned out the website was using URL rewrite module which i was missing.
This wasn't my problem and it was. I already had URL Rewriter installed, but after a Windows 10 upgrade IIS wasn't aware of it. A simple repair on Control Panel => Programs and Features => IIS URL Rewrite Module 2 and it was working again.
My issue was that I installed the .NET Core Hosting Bundle before I installed IIS. Re-running the Hosting Bundle installer with Repar fixed it for me.
https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/iis/?view=aspnetcore-3.1#install-the-net-core-hosting-bundle
If the Hosting Bundle is installed before IIS, the bundle installation
must be repaired. Run the Hosting Bundle installer again after
installing IIS.
I had this issue as well. Trying to run ASP.Net Core on IIS 10. All I needed to do was this:
Screen shot taken from: https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/iis/development-time-iis-support?view=aspnetcore-2.1
I had this issue lately , the solution for me was installing :
ASP.NET Core/.NET Core: Runtime & Hosting Bundle.
You can find it here.
Also before installing it , make sure your wwwroot security permissions is set to allow both iis_iusrs and iusr to have Read, Write and Execute permissions.
I installed .Net core Hosting Bundle from https://dotnet.microsoft.com/download/dotnet-core/2.2 and it fixed.
Similar to the marked solution here, I had the same problem and again it was a missing IIS module, but this time it was the Application Initialization Module that was required, not URLRewrite. installing via the Web Platform Installer or IIS.net. fixed the problem.
Steps I took to debug this though was to section by section go through my web config removing each section and attempting to load the site and/or let IIS parse the config. When I removed the section pertaining to initialization optimisation this fixed the issue and I immediately remembered that this dependency was added a fair while ago.
Echo the sentiments though that this really needs better error messages!!!
same here
also IUSR was missing from anonymous authentication credentials.
If the .net core Hosting Bundle is installed before IIS, the bundle installation must be repaired. Run the Hosting Bundle installer again after installing IIS.
works 100% ****check any urls are there inside <appSetting></appSetting>, try to comment these unknown urls
<!-- <add key="ErrorLogWebApi" value="https://websitename.com/api" />-->
and also comment <rewrite></rewrite> tag completely
now you try
I just double click on the Application that have the error and
change the version of the .NET Framework and
then change it back to the original version and
recycled the App Pools.
e.g.:
The application has .NET Framework v4.0.30319 and I changed it to .NET Framework v2.0.50727 then the Status was turn into Stop, then I double click back and change to .NET Framework v4 and then right click recycle and recycled it.
Same error message, but my C:\ had run out of disk space.

404.17 error - requested content appears to be script

I have a similar question to this one;
IIS 7.5
Server 2008
ASP.Net 4.0 web site
The error I get when trying to run the site is this:
HTTP Error 404.17 - Not Found
The requested content appears to be script and will not be served by the static file handler.
...
Most likely causes:
The request matched a wildcard mime map. The request is mapped to the static file handler. If there were different pre-conditions, the request will map to a different hander.
Now here comes the weird part:
THE WEIRD PART
The weird part is that on the develop server -- which is similar in every aspect to the production server -- everything runs smoothly.
Here's a list of things I cannot try, because I don't want to mess with the sever (it hosts many other sites):
Reinstalling .Net
Reinstalling IIS
Reinstalling anything
Running aspnet_regiis
Here's what I did try:
Republishing the site
Restarting the application pool
Changing the application pool to .Net 2.0 and back to .Net 4.0
Switching around between Integrated and Classic pipeline mode
Enabling 32-bit mode
Taking a look at Handler Mappings
Eventually I created a new application pool, and it sort of started working.
Q) "Sort of"?
A) Yes, sort of.
Now the site only works when the (new) app pool is set to .Net 4.0, Integrated,
and the site's Authentication has ASP.NET Impersonation set to Disabled.
Any change to these settings sets the server yelping "404.17" all over again.
Q) What's wrong with that?
A) What's wrong with that is that I NEED ASP.NET Impersonation for the site to function properly.
As always, your guidance is most needed.
HTTP Error 404.17 - Not Found
The requested content appears to be script and will not be served by the static file handler.
Usually this error occurs when you have the right IIS version installed to the respective .net framework. If it was a version (not installed) issue then you would have got a different error message. Anyways, I think by now you have resolved your matter, but I like to share some words with anyone else having this problem. These error messages gave me so much headache all last week and I had tried everything.
Best remedy is always to re install the latest .net in latest visual studio. And the important thing to do is uninstall the existing IIS(express or whichever you have) and re install it first. Then download the latest visual studio. This way visual studio installation can easily access you IIS and add the necessary application pool.
As for the error 404.17, it could simply be because the right application pool has not been assigned for the appropriate dot net version. If the right version is not there re installing visual studio is the only way I know. Also, I think you can try downloading another version of the Visual Studio too. For eg, download the ultimate if you have professional or vice versa. Hope this helps someone with similar problem.
Installing this windows server feature http activation is, what was missing for me.

Configuration Error: <compilation debug="true" targetFramework="4.0"> ASP.NET MVC3

I'm trying to deploy my website on somee.com but keeps getting this error
I've tried googling and it says I have to change my App Pool to ASP.NET 4.0. I've tried that already but with no luck:(
Informations:
-My site was coded in 4.0 Framework
-I'm using .NET Framework v4.0 Integrated
-I have checked needed things already in Windows Features
-Im using ASP.NET MVC3
-I already typed cd C:\Windows\Microsoft.NET\Framework64\v4.0.30319 then aspnet_regiis -ir to cmd
-64 bit OS
This is the steps how I publish my site
First I manually added this things to my Reference then changed the Copy Local to True
Microsoft.Web.Infrastructure
System.Web.Helpers
System.Web.Mvc
System.Web.Razor
System.Web.WebPages
System.Web.WebPages.Deployment
System.Web.WebPages.Razor
I Editted this on my Web Config
<configuration>
<system.web>
<customErrors mode="Off"/>
<compilation debug="true" targetFramework="4.0"/>
<authentication mode="None"/>
</system.web>
</configuration>
I add Deployable Dependencies that created _bin_deployableAssemblies which have this inside
Microsoft.Web.Infrastructure.dll
System.Web.Helpers.dll
System.Web.Mvc.dll
System.Web.Razor.dll
System.Web.WebPages.dll
System.Web.WebPages.Deployment.dll
System.Web.WebPages.Razor.dll
I then click Publish and have this settings
This is how I Publish is this ok or I have to change something here?
I went to my IIS Manager. I right click on Default Web site Under Sites and choose Add Application with this settings
This resulted to this
I went to C:/inetpub/wwwroot and sees this files
I then compressed it as zip then uploaded it in my account in somee.com then checked my site and now I'm getting the Configuration Error above.
ABOVE IS MY UPDATED QUESTION I REPUBLISHED MY SITE AND INCLUDED STEPS HOW I PUBLISHED IT . I INCLUDED IT SO THAT YOU GUYS COULD SUGGEST IF I'M DOING SOMETHING WRONG ON HOW I'M PUBLISHING MY SITE AND COULD BE THE REASON OF THE ERROR ABOVE. THANKS IN ADVANCE :)
My site works fine in the iis of the localhost of my machine it only gets that error when deployed on the internet.
Btw I'm following the tutorials from these sites How to Deploy an ASP.NET MVC 3 App to Web Hosting with "\bin Deployment" Programming ASP.NET MVC 4 Chapter 19. Deployment Deployment ASP.NET MVC 3 project to IIS and somee
Question: What could be the cause of this issue :( It's my first time to deploy a website on the internet. Hopefully you could help me guys.. If you need more info please tell me.
My IIS Manager
My configuration
or could this be the reason of my issue?
OK THIS PROBLEM WAS SOLVED. I FOUND OUT THERE'S NO PROBLEM ON MY SETTINGS. THE PROBLEM IS ON THE SETTINGS OF THE WEBHOSTING SITE. I CHANGED THE ASP.NET VERSION FROM 2.0 TO 4.0 BUT FORGOT TO CLICK THE UPDATE BUTTON :( I FEEL BAD I HAVEN'T REALIZED THAT. I'M NOW FACING ANOTHER ERROR BUT IT HAS NOTHING TO DO WITH THIS QUESTION. THANKS GUYS FOR TRYING TO HELP ME :)
This typically happens when you have an attribute of targetFramework="4.0" in the web.config but the App Pool is set to run ASP.NET 2.0. The targetFramework attribute is entirely unrecognized by ASP.NET 2.0 - so changing it to 2.0 won't have the desired effect.
Contact Support / Your Administrator and have the AppPool switched to 4.0.
You could also remove the attribute entirely, however if your site was coded with the 4.0 Framework, then I'm sure something else will cause an error as well.
Unrecognized attribute 'targetFramework'. Note that attribute names are case-sensitive
I was now able to find reason behind the error guys. It's on the webhosting site settings not on my app pool or what so ever. I changed the asp.net version from 2.0 to 4.0 but I forgot to click the update button. I feel so embarrased. :( I've been struggling for days to fix this error and only to found out its on the webhosting site settings. GgrrRR.. As of now I'm facing new error but has nothing to do with this question. Anyway thanks guys for your efforts to help me. :)
Try this, instead of selecting your websete's Application Pool to DefaultAppPool, select ASP.NET v4.0
Select your website in IIS => Basic Settings => Application Pool => Select ASP.NET v4.0
and you will be good to go. Hope it helps :)
Also try aspnet_regiis -u then aspnet_regiis -i on below path
C:\Windows\Microsoft.NET\Framework\v4.0.30319
Now restart the IIS and check
Hope this will help !
You could be using the 32 bit version, so you should prob try at the command line from the Framework (not Framework64) folder.
IE Did you try it from
C:\Windows\Microsoft.NET\Framework\v4.0.30319 rather than the 64 version? If you ref 32 bit libs you can be forced to 32 bit version (some other reasons as well if I recall)
Is your site a child of another site in IIS?
For more details on this (since it applies to various types of apps running on .NET) see Scott's post at:
32-bit and 64-bit confusion around x86 and x64 and the .NET Framework and CLR
Make sure that you are building your web app as "Any CPU". Right click your web project --> Properties --> Build --> and look for the "Platform Target". Choose "Any CPU" or play around with it.
Hope this helps!
Each individual Web App under an IIS Web Site can use a different App Pool.
Verify the App Pool assigned to your app (not just the root site per your pictures) is .NET 4.0 compatible:
Expand Default Web Site
Right click on ProjectPALS, choose 'Manage Application' then 'Advanced...'
Observe the 'Application Pool' your app is running as under the site
Change to another App Pool if neccessary
How are you running the application? Are you just hitting the website or are you building and running from within Visual Studio? If you are building and running you may want to tell it to use the local IIS web server. This would make sure it is using the App Pool you have set up to run with v4.0/integrated.
I am guessing that it is using the Visual Studio Development Server when running. This server is probably trying to run with the 2.0 framework. This then causes your error to be thrown.
Edit: To note, I normally just build my website application and then I attach to process w3wp when I want to debug. I do not use the publishing tool. Of course this means my local working directory is within the web root.
Have you tried the aspnet_regiis tool to register .Net 4.0 for IIS? You can check more at msdn
My problem was solved that way:
Your username is probably restricted, You must grant full access to the user.
Right Click on Project and select Properties
Click on Tab Security
Click Edit button
Found Current User and Permission for User Allow Full Control
If your application is 32 bit, and you want to deploy in a 64 bit machine, You need to set 'Enable 32 Bit Applications' property to 'True' in the application pool - advanced settings.

How to publish asp website using IIS7

I am trying to host my web application in IIS7 (for testing purposes). I have checked tutorials how to do it, they are very similar, but i always get some errors. I guess i'm missing something, hope you could help me.
Things that i have now:
1. Installed IIS7 with asp net (the IIS welcome image is showing, so i guess its installed correctly)
2. Simple web application (only with Default.aspx and some other automatically generated files)
I'm using tutorials like this one:
http://www.codeproject.com/Articles/28693/Deploying-ASP-NET-Websites-on-IIS-7-0
For those who may not want to click the link, here are the steps of this tutorial (just with mages and some additional info):
Step 1: From Visual Studio, publish your Web application.
Step 2: Copy the published application folder to "C:\intepub\wwwroot" [default] folder.
Step 3: From RUN - > inetmgr -> OK
"TestWeb" is a recently pasted webapplication on your wwwroot folder.
Step 4: We need to convert it to an application, just right click and then Click on "ConvertToApplication" as shown in the following picture:
+ How to create and assign application pools
Now about the errors i get when i'm trying to connect to the running Sample website:
1. If I'm using Framework 4.0 integrated application pool:
HTTP Error 500.21 - Internal Server Error
Handler "PageHandlerFactory-Integrated" has a bad module "ManagedPipelineHandler" in its module list
2. If I'm using Framework 4.0 Classic application pool:
HTTP Error 404.17 - Not Found
The requested content appears to be script and will not be served by the static file handler.
My guess is that something could be configured wrong in IIS7 or i might be publishing my web application not the way it has to be published, because they differ in tutorials that i am using. For now i am publishing, using File System option. Is it the right one for IIS7?
Hope anyone could explain me my mistakes.
Thanks, Walt
The answer for the questioner was to run the aspnet_regiis.exe -i from the framework directory
Below suggestions and comments leading to this answer :
I never had problems when publishing websites and webservices on IIS7 (for the moment) but I did a little research and according to the following link : http://forums.asp.net/post/3225843.aspx
It is suggested that after switching the AppPool to Classic .NET AppPool, it may be required for you to uncomment a section in the web.config which is necessary for IIS7
Did you try that ?
For number HTTP:500.21 check this asp.net forum
"Looks like you have not installed the asp.net feature from within IIS in "Add/Remove windows component" so that all the regstration needed to run asp.net is not present in your configuration." from the page.
For number 404.17 please check the asp.net module if properly installed or not. If not then you might have to install manually. Check this thread.

Resources