How to host ASP.NET Web API 2 project on IIS 10 - asp.net

I am trying to host an ASP.NET Web API 2 project on IIS 10, and I keep getting a page saying Service Endpoint not found.
The project I am using for testing is the sample ProductsApp project here Getting Started with ASP.NET Web API 2. If I run the project in debug, then the page shows up as expected while it is being hosted through VS2012 IIS express at localhost:54170
I am then publishing that project to file using VS2012.
After publishing to file, then I made a new site on IIS 10 at localhost:8080 and point the physical path to the folder that I published the ProductsApp project to.
At this point if I go to browse the site it comes up with a page that all it says is Service Endpoint not found.
I've changed my DefaultAppPool Identity to LocalSystem, so I don't think it's a permissions issue.
How do I get the site to show up like it does when I'm debugging from VS2012, but from IIS 10?

I wasted so much time yesterday trying to figure this out, but this morning with a little fiddling I found my answer which I'm surprised I wasn't able to find anywhere else I looked.
To fix my problem this is all I had to do.
Instead of hosting the ASP.NET content as its own site I just needed to add an application to my default web site with the physical path pointing to the folder that was published from VS2012.
This is obviously my first time using ASP.NET, so I didn't have any of the ASP.NET features installed in IIS. I went to Turn Windows features on or off -> Internet Information Services -> World Wide Web Services -> Application Development Features, then selected all of the ASP folders (ASP, ASP.NET 3.5, ASP.NET 4.6). Edit: Looking back at this, all that was required was turning on the feature ASP.NET 4.6. At the time I didn't know what I was looking for, so I tried to nuke the problem by installing everything with "ASP" in the name.
The DefaultAppPool Identity didn't need to change to LocalSystem, so I changed it back to ApplicationPoolIdentity.
Now I have the ASP.NET site up and running on my localhost.

Related

IIS-based Web Service

I have created an ASP.NET Web Application in Visual Studio Community 2019. I am trying to deploy a web service in IIS but I keep getting the 404 Not Found error. The application pool in the IIS manager looks like this
I create a connection
and then publish the application but I get this error
The .NET Framework is 4.7.2
What did I do wrong?
As per your screen shot application is hosted with virtual directory Webapp.
URL Should be http://Localhost/webapp/webservice1.asmx
First change url to http://Localhost/webapp/webservice1.asmx. Then check Mapping to an ASMX service using routing in ASP.NET MVC for solving the mapping problem.
I suggest publishing the site to the folder. Then create a new site in IIS Manager and show its physical path to that folder. Give your site some path like localhost:3600. Then when you open that path in the browser and search http://localhost:3600/WebService1.asmx, it will definitely work(at least it worked for me)

Can I deploy an asp.net web forms application to a Windows 7 laptop computer?

I've created a small application for internal use with asp.net web forms. I don't have a server to deploy it, but would like others in the office to have intranet access. Just a handful of people will have access (2-6). It is not a public-facing application.
I saw the following instructions on this site to deploy an asp.net mvc application to a desktop computer-using IIS 7.
1.Install IIS from the standard windows components.
2.Put your code in the root directory of the default created web site.
3.Be sure the firewall is allowed the 80th port.
Would the procedure be the same for my asp.net web forms application--or is there something inherently different (between web forms and mvc) that makes this impossible?
Thank you for your help!
The instructions would stay more or less the same. The process can be a little more complicated than what you've described in the steps above, but it's a good starting point.
In addition to making sure port 80 is open, you'll probably need to assign an IP address for the site too. See the illustration below:
It should work exactly the same.
One thing you'll need to check is that the ASP.NET framework version the default web site created by IIS7 is using is the same as the version your code was created in. To do this; goto IIS -> Application Pools -> DefaultAppPool then check the .Net Framework version.
Bar that; as long as the physical path of the Site inside IIS is pointing to the correct folder it will work the same as MVC would

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.

IIS 7 w/ MVC 3 Permissions Issue

I currently am in the process of deploying a MVC 3 Web App to an IIS 7 server. When I work on the web app from visual studio and deploy through development server, the web app has no problem using a custom .dll that interacts with a local server. However, when I deploy onto IIS 7, the same dll fails to pull data from the server through the dll. I am assuming this is permissions related. I have assigned the AppPool to use an account I created that is a member of the local 'Adminstrators' account. No Success. My account is a member of this group. One quirk I noticed was when I tried to modify security setting in the %WINDIR%\inetsvr folder, which holds the process that runs web server for IIS, I was unable to modify these setting even tho I am a member of the 'administrator' account. Confused about this, and have been running around in circles trying to figure this one out. Any help would be appreciated.
Your web app's associated user definitely don't need to have access permission to %WINDIR%\inetsvr.
Assuming that your website runs on C:\interpub\myWebsite and .Net 4.0, your web app's user needs to have at least reader access to following folders :
C:\interpub\myWebsite
%windir%\Microsoft.NET\FrameWork\v4.0.30319\Temporary ASP.NET Files
If you don't grant those access to those folder then it is so likely that your app won't run.
Also, visit your site with a browser inside your production server and see the detailed IIS error. That might help to narrow the problem down.
NOTE
Also, be sure that your app pool is in integrated mode because ASP.NET
MVC won't work properly under classic mode if you have extensionless
Urls. It is highly likely that you will get 404.

Windows Server 2003 IIS Renders ASP.NET 4.0 pages as blank

I have a web project which works fine on my local development machine.
I copied the project to our UAT server, setup a virtual directory pointing to the project and configured it to run on .NET Framework 4.0. I even added the Default.aspx page to the Documents tab. I configured Directory Security to use Windows Authentication.
When i try to access any web page within this application, IIS responds with a blank page. I looked through the event logs and don't see any errors anywhere.
Can someone please help me understand what's going on and how to remedy this?
Thanks in advance!
If you're just seeing a white page with no errors in the event log, it sounds like it could be a problem with the application rather than the hosting environment.
However, there are a few things you could try to doing to troubleshoot this.
Check folder permissions. Try allowing "Everyone" access on your webroot folder and see if that makes any difference.
Confirm that the IIS path is set up correctly but putting a text file in your webroot folder, and then browsing to it and verifying that it's contents are displayed.
Create a basic test.aspx page without any script, just a "Hello World" bit of text, and try browsing to it. Confirm that it displays the correct content.
Edit web.config and turn off custom errors
Try re-registering the ASP.NET extensions with IIS using aspnet_iis (details here)
Hopefully, one of these tests will be able to give you some kind of detailed error message or more insight into the cause of the problem.
For IIS 6.0 on Windows Server 2003, after the install of .NET Framework 4.0, the process of creating Web Sites or Virtual Directories that run under .NET Framework 4.0 is as follows:
Create a new application pool.
Applications running under different
frameworks can't be hosted in the
same application pool, i.e. create
an application pool perf framework.
Next, if you are creating a local
intranet site or virtual directory,
ensure that you don't have "dots" in
the application name. Browsers
confuse the dots to be external web
sites, forcing them to run under
internet zone as appose to the
intranet zone.
Once you create your web site or
virtual directory, make sure that it
runs under an application pool
dedicated for .NET 4.0 applications.
Ensure that when creating your
website or virtual directory, you
click on the ASP.NET tab and select
version 4.0 from the drop down.
Then you may configure as per
normal, with any other additional
settings you may require.
Hope this helps someone experiencing similar issues. Took a while to figure out.

Resources