I have an VS (2017) Web Application project. The project complies and runs correctly etc.
The problem I have is when I press the debug button and it starts debugging using IIS Express in Edge, I am always presented with a popup to provide credentials before the page is shown. The page is loaded correctly once the credentials are provided, but I have to do it each time and it can become annoying.
Anonymous access is disabled and Windows Authentication is enabled in the Project Properties.
I a have tried running VS in adminstrator mode but no luck.
How do I not have the credentials box appear?
set the hostname which you are using in the iis site binding to the visual studio project.
1)Open the project which you are using to attach the worker process for debugging.
2)Right-click on the project -> select properties
you will see that there are 3 options for executing your application. IIS Express, Local IIS or External Host.
You can now use Local IIS like the configuration below.
A second option, that is if you are using like me a custom hostname, is to select External Host.
Related
Our company ships an MVC based product (targeting v4.5) which has stopped working on a customer site for what appear to be environmental issues - a build which worked with no problems once upon a time now gives a 403.14 - The Web server is configured to not list the contents of this directory.
.
What I think is happening...
The user accesses http://server/AppName
Because it's an MVC app, the default route (Reports/Index) should be used.
Instead IIS is looking for a default document...
... and, not finding one, it assumes the user wants to list the contents of the directory...
...which is not enabled so it throws a 403.14.
.
What I've tried so far...
Accessing the route directly.. results in 404 error. So I'm pretty
sure IIS doesn't realise it should use routing.
Use aspnet_regiis to register ASP.Net with IIS. This was done from the Framework64 folder since...
OS is 64 bit - Windows Server 2008 (Standard without Hyper-V)
IIS is 64 bit - though Enable 32-Bit Applications is true
Checked AppPool is targeting v4 of the framework - it is.
Changed AppPool mode to Classic - was pretty sure it should be integrated but was worth ruling it out. It is now back to Integrated
Confirmed RunAllManagedModulesForAllRequests is set to true in the web.config.
Checked permission conditions defined in <system.webServer> section of web.config are met - they are.
Created the simplest of MVC applications and deployed it - same problem.
Running the command shell as Administrator unregistered ASP.Net using aspnet_regiis -ua and re-registered using aspnet_regiis -enable -i. We hit a couple of permission problems - and the Temporary ASP.NET Files directory was missing but once they were address we were back to the same error.
Added a simple default.htm - when present, this is served in response to the http://server/AppName request.
I'm clean out of ideas and all google hits suggest some combination of the above - or enabling directory browsing (which I think is just a symptom rather than the root cause).
Also, not sure if it's relevant but the amount of configurable elements available for the application in IIS seems a bit below what I would have expected...
Have you Checked the user the application pool process is running under? I think Your site needs to run with permissions to execute the .net libraries and I've seen this just change for seemingly no reason (probably related to an overzealous update to the system).
You can try with the Enabling directory browsing .
assuming you are under Windows Server 2012 or Windows Server 2012 R2
On the taskbar, click Server Manager.
In Server Manager, click the Manage menu, and then click Add Roles
and Features.
In the Add Roles and Features wizard, click Next. Select the
installation type and click Next. Select the destination server and
click Next.
On the Server Roles page, expand Web Server (IIS), expand Web
Server, expand Common HTTP Features, and then select Directory
Browsing. Click Next.
On the Select features page, click Next. On the Confirm installation
selections page, click Install. On the Results page, click Close.
if you using the Windows PC try this in your command prompt as follows:
go to C:\Program Files\IIS Express
then press Enter:appcmd set config
/section:system.webServer/directoryBrowse /enabled
Maybe this is your case https://forums.iis.net/t/1157304.aspx
SQL Server Reporting Services creates a folder called Reports by
default if you install it on IIS. If you install SQL 2008 then
Reporting Services doesn't need to use IIS and instead will try to
reserve the URL with the HTTP.Sys service.
I believe this is the cause of the conflict you are seeing. What you
could try is changing the URL that Reporting Services uses via the SQL
Server Configuration Wizard.
Also I found that
Report Manager of SQL Server can use reports path http://<server name>/reports
Configure a Native Mode Report Server for Local Administration (SSRS)
I think the problem is IIS features that are not installed yet. I have met this kind of problem frequently in Windows Pro. Make sure to turn on every feature under Internet Information Service -> World Wide Services because by default IIS is configured to use WebForms. So there might be some features that not installed yet to use MVC, especially ISAPI filters. In my case, that was the solution. I hope it helps.
Something similar i encountered using VS 2017 & ASP.NET MVC.
Was working on the project for long with no problems at all but suddenly the routing started misbehaving & stopped working.
So I changed the Port in Project Properties Page & it started working.
I really don't know what is the relation between a port & MVC routing modules. Someone else can enlighten if at all this helps.
I had the same problem and I just created an application pool out of the Default Web Site in IIS and stoped the default web site. With that difference you will not have the application pool's path
I know it's been a long time since this question but i've had the same problema recently. I've tried every single configuration, just like #amcdermott did, but the only action that solve the problem was reinstalling .NET Framework.
My app was built under .NET Framework 4.5.2. The application server had the version 4.6.1 and 4.5.2 installed. So, i uninstalled all framework versions and installed the one that i needed.
Please, make sure that no other applications use superior versions of .NET Framework if you going to try this solution.
Here are some quote I find on Microsoft official site which I think may help:
For site administrators
This problem occurs because the Web site does not have the Directory Browsing feature enabled, and the default document is not configured. To resolve this problem, use one of the following methods:
Method 1: Enable the Directory Browsing feature in IIS (Recommended)
To resolve this problem, follow these steps:
Start IIS Manager. To do this, click Start, click Run, type inetmgr.exe, and then click OK.
In IIS Manager, expand server name, expand Web sites, and then click the website that you want to modify.
In the Features view, double-click Directory Browsing.
In the Actions pane, click Enable.
Method 2: Add a default document
To resolve this problem, follow these steps:
Start IIS Manager. To do this, click Start, click Run, type inetmgr.exe, and then click OK.
In IIS Manager, expand server name, expand Web sites, and then click the website that you want to modify.
In the Features view, double-click Default Document.
In the Actions pane, click Enable.
In the File Name box, type the name of the default document, and then click OK.
Method 3: Enable the Directory Browsing feature in IIS Express
Note This method is for the web developers who experience the issue when they use IIS Express.
To do this, follow these steps:
Open a command prompt, and then go to the IIS Express folder on your computer. For example, go to the following folder in a command prompt:
C:\Program Files\IIS Express
Type the following command, and then press Enter:
appcmd set config /section:directoryBrowse /enabled:true
I am running Visual Studio 2008, IIS 7.5 on Windows 7 x32. I am able to run the ASP.NET web site in IIS 7.5 without debugging just fine, but when I press F5 to debug it, I get:
Unable to start debugging on the web server. Unable to connect to the webserver. Verify that the web server is running and that incoming http requests are not blocked by a firewall..
In VS, right click on your web project --> Properties
Go to the Web tab.
Make sure the appropriate radio button is selected (Use VS Dev Server, Use Local IIS Web Server, etc)
After a computer freeze I've had that value change on me.
Another thing to try:
run "iisreset" from an administrative command prompt (basically just restarts the IIS service)
Check if your IIS is running, if isn't try to initialize him and run again on VS.
Try the following:
Open IIS > Add a new Application (not a virtual folder) to the Default Website.
Make sure the application runs under the right .net framework version (i.e. DefaultAppPool ussually runs under .Net 4.0)
Map the application in IIS to the right project folder (where your bin and obj folder appear after a build)
In IIS, right-click the application, and click 'Manage application' > 'Browse'. This will launch an internet exploreren to the right path. This could be localhost:80/Shop instead of the expected localhost/Shop (caused by for example a reservation for other applications of the direct localhost/ location)
In Visual Studio > go to the application properties > Web > check Use local IIS > and set the correct location of your application in IIS (you should know this from step 4)
Verify that your web.config has the following entry:
<compilation debug="true" targetFramework="2.0" />
Note: If you are targeting framework 1.1, then obviously change the 2.0 to 1.1.
UPDATE:
The `targetFramework` attribute is new in .NET 4.0 and later, so to enable debugging on .NET 2.0 and earlier, then you cannot use the `targetFramework` attribute, like this:
<compilation debug="true" />
Just to check: See if Windows Authentication is enabled or not? It should be enabled.
Internet Information Services (IIS) Manager > Expand PC/Server Name > Expand Sites > Select Default Web Site > Select Authentication. It should be enabled.
Make sure that the port defined in the Project Url under the Web tab of the properties of the web project is the same one as defined in the IIS Manager.
I had this issue and fixing the port solved the problem for me.
I had a case, where I could load the site in chrome, but deugger could contact the server. Turns out Chrome auto-maps .localhost addresses, but VS does not.
Adding the localhost address to my hosts file solved the issue.
I've been trying to fix this for quite some time now, but I simply can't make any ASP.NET projects in Visual Studio Express 2012 for Web. I get this error when I start a new project:
Web application projects are currently configured to use IIS Express. To switch back to using the Visual Studio Development Server, change the development server option under the Projects and Solutions/Web Projects Category of the Options menu. Configured IIS Express failed with the following error:
Filename: redirect.config
Error: Cannot read Configuration file.
So I went on the internet to try and find others with the same error but I can't find a concrete solution to my problem. I find something similar for older versions, but it doesn't fix my problem. I do have the IIS Manager up under my Services (When you want to Manage Windows). I even made a virtual folder, but to no avail. Still doesn't work.
I want to use IIS
How do I fix this?
In Solution Explorer, right-click the name of the Web application project for which you want to specify a Web server, and then click Properties
In the Properties window, click the Web tab.
To choose the Visual Studio Development Server, under Servers, click Use Visual Studio Development Server.
To use a specific port number with the Visual Studio Development Server, select Specific port and enter the port number. By default, the Auto-assign Port option is selected, and the port number that has been assigned to your application appears
To choose IIS, under Servers, select Local IIS Web server. This option is not available if IIS is not enabled on your computer. A URL that combines localhost with the name of your Web application will automatically be created for you and appear in the Project URL box (for example, l ocalhost/WebApplication1).
To choose IIS, under Servers, select Local IIS Web server. This option is not available if IIS is not enabled on your computer. A URL that combines localhost with the name of your Web application will automatically be created for you and appear in the Project URL box (for example, loca lhost/WebApplication1).
To choose a custom Web server, select Use Custom Web Server. In the Server URL box, type the URL that Visual Studio should start when it runs the current project.
You may for example open you project file in notepad search for the string <useiisexpress>true</useiisexpress> replace it with the string <UseIIS>True</UseIIS> save and reload the project.
Make a copy of the project file first though.
I am developing a remote control application where a client (aspx page in a browser) can request a server to "launch a notepad" (for testing purpose, for real life, turning off a light bulb, etc). So I created a dll with a simple function for launching the notepad (on the server side) and dropped this dll in the root bin folder.
It worked fine when the aspx page is running under ASP.NET development server (launched from Visual Studio). But when I tested the same aspx page under a FireFox browser, it did not work (launch the notepad) even though it did call for the same function (I stepped through in debugger).
Is this a permission issue? How do I set this up in IIS manager, or even better in web.config?
Please help.
Yes, it sounds like a permission issue.
The application pool in IIS 7 that your site is running under is probably using the default identity, which is the most restrictive. You can change the identity in IIS Manager by right-clicking on the app pool (probably called DefaultAppPool) and selecting Advanced Settings. From there change the Identity value to Local Service or Network Service. If neither of those work, making it Local System should allow your page to work.
I assume the Visual Studio integrated web server runs under the context of the account you are logged in with on the machine, which likely has a lot more rights.
When you say:
it did not work (launch the notepad)
Did you mean it through an exception or you didn't see a notepad window open. If it was a permissions issue I would expect you that you would get an exception. Chris is right on when he says:
The application pool in IIS 7 that
your site is running under is probably
using the default identity, which is
the most restrictive.
and
I assume the Visual Studio integrated
web server runs under the context of
the account you are logged in with on
the machine, which likely has a lot
more rights.
and if this is a permissions issue he is right on. However, the user your running under (when not debugging in Visual Studio) most likely cannot access the desktop of the logged in user. Maybe you should try your test with an app that doesn't need to interact with the desktop.
I am new to visual studio/asp.net so please bear with me. Using vs 2005 and asp.net 3.5. I have vs installed on the production server. If I set the start option for the site to "use default web server" when I go to debug my website vs tries to open the site at http://localhost:4579/project and returns 404. If I set start option to "use custom server" and specify the correct path to application (the way I would hit the site from the outside) vs is unable to run debug and returns error "Unable to start debugging on the web server. Logon failure: unknown user name or bad password". I am running vs as an administrator on the production server. I thought maybe I needed to set user permissions in the visual studio remote debugging monitor but my admin account was already there. I checked IIS and made sure the application configuration/debugging "enable asp server-side script debugging" was checked. Web config is also set debug="true". Clearly I am missing something.
EDIT >Running windows server 2003
Do this...Instead of trying to debug by hitting F5
Go to Tools
Attach to Process
Click View Processes from all users
Ensure you are selected only for Managed Code
Select "W3WP.EXE". This is the ASP.NET Worker process.
Click attach.
You are now attached and debugging, go refresh the page in a browser and it should hit your breakpoints.
Are you running on Vista or Server 2008? I'm not sure about Vista, but when I was running Server 2008 I had permission errors when trying to debug when I launched VS as my regular user. The solution for me was right-clicking on the VS icon and selecting 'Run as Administrator'.
The account you are running under needs to be part of the developer user group. Otherwise you will not be able to debug correctly.
Have you checked that you have Integrated Windows Authentication switched on for the required web site. This is required for debugging.
Note: You can have this and the Annonomus access enabled at the same time. This means the site sees logged in users as their user account and not logged in users as the Annonymous account. Not logged in users will only see a login box if the application tries to access something that requires a login.
To debug Javascript you have to enable it in IE's settings. Uncheck both the settings at "IE->Tools->Options->Advanced->Browsing->Disable script debugging" before debugging.