When I run my .Net6.0 web api project in Visual Studio, Swagger UI opens automatically in a new chrome browser. How can I stop this from happening?
.Net 6 integrate Swagger in the template. If you want to not auto open a tab in your browser, then you can comment "launchBrowser": true. If you want to auto open a tab in your browser but not the swagger UI page, then you can comment the variable "launchUrl": "swagger", then a new tab will open automatically and direct to the home url like https://localhost:7280 in my test example.
Open your launchSettings.json file and comment all variables "launchBrowser": true. In my screenshot below, since I didn't start my api app with IIS express, so I didn't comment this variable in IIS Express.
Related
I have a web application required to run as a Web Site (root application). This is due to it being a multi tenant application that uses the urls sub domain prefix to know which client is accessing it. I create the site in IIS 10 setting the physical path to my Visual Studio 2017 .NET 4.5 MVC application and the site works fine.
I open the web project properties and under Servers choose Local IIS setting and set Project Url to the site I just created in IIS. Visual Studio then forces me to create a Virtual Directory for the Project Url, to save it, which then creates a Web Application under the default web site. You can't set and save the Project Url without being forced to create the virtual directory.
Now when I start debugging Visual Studio attaches to the Web Application not my web site so my breakpoints never get hit. If I manually attach to the w3wp process where the web site is running I can debug. I had this all working fine prior to recently switching to Git causing me to reconfigure things and I can't recall what I did to make it work.
How can I set the Project Url on web properties page without being forced to create a virtual directory? Or how do I make VS automatically attach to the Web Site and not Web App I was forced to create?
This blog might help: How to Debug Your ASP.NET Projects Running Under IIS
If your project is a website and not a web app, then here are the steps to configure it to use IIS when debugging. This assumes you already have IIS set up and hosting your project.
In the solution explorer.
Right-click on your project node and navigate to "Property Pages".
Navigate to "Start Options" item in the left pane.
In the "Server" section make sure "Use custom server" is checked.
In the "Base URL:" field put in the address you have mapped to your project. (Usually the address you put in your hosts file)
I finally discovered that setting the Servers 'Project Url' in the web projects properties page to 'http://localhost/' does not force you to use the 'Create Virtual Directory' to save the changes. You can't even change the default port here without being forced to create a virtual directory.
I am new to Silverlight, I have created an application having DLL Project, Silverlight project, and Silverlight.web project. Now I wanted to publish or deploy it in the IIS so that I can test the Silverlight web application.
Can someone help me to deploy and publish silverlight web application?
Right Click the Silverlight.Web project in Visual Studio.
Select the publish option.
Enter your web site configuration in "Publish Web" window.
If you are really new to IIS you can find a very basic setting to get started with in the "e.g." below the text boxes in the "Publish Web" window that opens up viz. "localhost" & "Default Web Site/MyApp". Add the Silverlight mime type (application/x-silverlight-app) to your IIS config. How to? > http://learn.iis.net/page.aspx/262/configuring-iis-for-silverlight-applications/
http://localhost/MyApp/SilverlightApplicationTestPage.aspx should point you to your site.
Response to your extended issue from comment,
Since you now see login page, further steps
var canYouSeeAnySLonIIS = Is your login page made in SL?
try
{
If (!canYouSeeAnySLonIIS)
{
probably you won't have IIS setup for Silverlight apps. Add the silverlight mime type to your IIS. How to > http://learn.iis.net/page.aspx/262/configuring-iis-for-silverlight-applications/
}
else
{
I don't have the specific solution to your problem but here since you can launch some SL from your IIS now, here is a tip that will help this and any other similar issue. You might want to try debugging the SL app inside IIS using VS. How?
Launch your login(SL) page in IE (for simplicity). In vS, Tools > Attach to Process > search for iexplore.exe, make sure you select the one where the type column indicates "Silverlight, x86", this is the SL plugin sandbox process. Attach. Voila!
A slight variation if you are using firefox, the process name will be plugin-container.exe
}
}
finally
{
Generic debugging tips > http://boxbinary.com/2010/04/debugging-silverlight-in-visual-studio-breakpoints-not-being-hit/
}
In visual studio MyProject properties I set the Login.aspx page as startup page and it works fine when I use the local host, however when I publish to the external host server the startup page is ignored and the aspx page in the URL is displayed. What am i doing wrong? host server has IIS6, 3.5 FrameWork
Startup Action, and specific page in this case is only used for Debugging purposes, not for the initial page to load on your web host.
If your web host is using IIS7, you can use the <defaultDocument> web.config element.
Otherwise, you can set the value in IIS (see here), or possibly find a workaround elsewhere.
The startup page is only for the ASP.NET Development server that is created by Visual Studio..used for testing & debugging your code.
Since you're publishing to IIS 6.5, you can set your default documents(s) on the website's Documents tab in IIS. Add your default starting page to the list there & move it to the top.
On II6 if you right click the web site --> Properties then go to Documents, there is a Enable Default Document. That list is where the default document is set.
when I try to view ASP.NET website in browser I get the full list of files in the website folder. What could be the reason?Is there only one reason or there might be a lot?
That could happen if you have not specified a start page for your web application.
Right click on the web page you want to use as the default page and choose "Set as Start Page" whenever you run the web application from Visual Studio, it will open the selected page.
Refer to the following:
Set Default Page in Asp.net
Setting the default page for ASP.NET (Visual Studio) server configuration
EDIT:
If you are launching the site from within Visual Studio, you can set the default page by doing the following:
From this SO question answer
Right click on the web page you want
to use as the default page and choose
"Set as Start Page" whenever you run
the web application from Visual
Studio, it will open the selected
page.
You need to specify on the server (in IIS) what the default page is, and disable directory listing for the site.
See also:
Setting the default page & disabling directory browsing in ISS / Web.config
It could be any of the other cases mentioned in the answers OR
IIS by default looks for these files in the directory to serve in the given order if no file is specified.
Perhaps you have not specified a file, and turned on "Directory Listing"
I am trying to debug a web application through IIS that has a virtual directory other than localhost. It compiles fine but gets the above message anytime that I try to start debugging. I have compilation debug="true".
Right click your 'web' project and select 'property pages'. Then change 'Start Options' to 'Don't open a page. Wait for a request from an external application.' and for server, select 'Use custom server' with Base URL: 'http://localhost/your_virtual_dir/'
Then with a web browser opened pointing to the IIS location (and virtual dir) you setup, the two should work in tandem with each other.
Hope that helped.
Error: Unable to Start Debugging on the Web Server
Check the points in the MSDN article above. IME, its normally one of these things:
Has the application directory been created as an application in IIS?
On the Directory tab, under Application Settings, next to the application name you will see the create button. Click this!
On the ASP.NET tab in IIS, has the correct version of the framework been selected?
Re-register ASP.NET:
From a command prompt window, run the following command: systemroot\Microsoft.NET\Framework\ versionNumber \aspnet_regiis -i