Prevent Visual Studio web project start https - asp.net-mvc

i have a web project where i wanted to start with SSL then in HTTPS, so doing some configurations... now i changed idea and i want to start without HTTPS, i cleaned my configurations, but when i run the project, IIS Express starts 2 projects, (see images). What can i do to remove the project with https?

Have you set your Solution properties to specify which projects should start?

there are a few things to check
make sure you Clean and Rebuild,
delete all Temp files from Windows\Microsoft.Net\Frameworks then 64 or 32 bit.
Have you created the actual app in IIS by hitting the "Create Virtual Directory button"?
If you have, then https will be a binding there, so just go and delete that.
Finally check your web.config, to make sure there is no https reference sticking around anywhere.
One of these should do the trick.

You can manually open .vs/config/applicationHost.config (VS2015) to remove the https binding from that site, or Documents\IIS Express\config\applicationHost.config (VS2013 or below). Of course, you can use Jexus Manager for IIS Express to do the same using a simple user interface, http://jexusmanager.com

Related

How to debug an ASPNET Core application in a subfolder

I have a ASPNET Core application that works fine on my machine with URL https://localhost:5001/, but not on the client's server, where the application's URL is https://example.com/subfolder/.
The problem seems to be an error in a redirect on one of the pages, where a user is sent to /something rather than /subfolder/something. I'm using relative URL's only. In the rest of the application, redirects work fine.
I was wondering if it is possible to debug the application in Visual Studio and have it run in a subfolder, preferably using Kestrel, but IIS Express might be an option too.
Update after comments While adding specifics about the problem, I found out that I was looking at it from the wrong angle. The actual problem seems to be that the application is started as https://example.com/subfolder (no trailing slash). Redirecting to ./something (or just something) will result in https://example.com/something.
(My real question therefore would be: If https://example.com/subfolder is opened, how can I redirect to https://example.com/subfolder/? I'll first try to fix this myself, maybe it should be configured in the webserver. In the meantime, I'd still like to know if subfolders can be used in debugging)
In development, it seems you can't debug your program in subfolder.
I don't recommand you to spend a lot of time to serach how to do that, and I also suggest you use IIS. Because in IIS, it supports Virtual Application, and I think it is you want.
Steps:
create a main website, and create a virtual application.
choose the project folder as Physical Path, mainsite and virtualapplication.
open vs2019 as administrator, maybe you need open it twice,and one for main site and another for virtual application.
then you can attach to a running process on your local machine.
you can start your two webapp in one port, and you can debug them.

visual studio not updating html / javascript to server / browser

This is an MVC 4 app using the Hot Towel SPA template. Whenever I change anything in the HTML and/or javascript the only way I can get the new code to display is to clear the browser cache. F5, cntrl-F5, shift-F5, nothing works.
I'm not normally a web dev and just learning this. I've done regular MVC before and not had this issue, maybe it has to do with where the HTML and javascript is in my project (i.e. in the /App folder) ?. I'm going nuts trying to figure this out.
I can completely delete an HTML file and run the app and it still runs as it did. Clear cache and run and I then get the update.
It's running using IIS express using Firefox, Chrome, IE...
Thanks..
In Opera and Chrome (and possibly others), you can disable caching while in 'development mode'.
While in DevTools, the 2nd option in the Settings menu is
Disable cache (while DevTools is open)
Go to your web.config file and make a change in it.Its not matter what change you make.For example type a character and then delete it and build the project and run it again.I hope it works.
I also experienced this issue and turns out it was related to caching.
If using Chrome DevTools, you can simply disable cache by navigating to the Network Tab and ticking Disable Cache
This will only disable the cache when Dev Tools is open.
ctrl+shift+F5 will do the trick! Seems like browser cache is part of the problem :)
in my case iis express not updated site, but site , created by iis Manager worked correctly?
possible solution for this problem is
set "use this 64 bit version of iis express for web sites and projects" option at visual studio
it located at options->Projects and Solutions->Web projects
I found that I had the .js file open in the Chrome Developer Tools -> Sources View.
When I closed the file there and refreshed the page the new .js file showed up as expected.
The browsers cache by default. You can turn off caching in your browser to get the changed files.
I had an issue with moved .ts & .html files on the server and had to:
stop debugging
clear the whole output/dist folder inside my ClientApp
start debugging again
Ctrl-F5 to force the cache to refresh on the browser
Simply disabling the browser's cache, or forcing the .net app to recompile, or even running ng serve had no effect.
None of the above listed methods works consistently and if one considers that different browsers are used in the task pane depending on Windows version/build used then you may have to clear the cache of a different browser in each case.
However, it seems that the real issue is not so much browser caching as it is VS deciding which files to deploy to the local IIS Express server used for testing/development. In many cases, when pressing the "Start" button, modified html and/or js files won't make it to the local deployment even if you also modify the web.config file.
The way I made this work consistently is I selected the web application project (in Solution Explorer), opened properties, clicked the "Package/Publish Web" tab and then under "Items to deploy" I selected "All files in this project".
Works fine for me!
If you just want to test locally You can try
A) Create Virtual Directory
Follow below path: Project / Properties / Web
Find Servers section
Click on Create Virtual directory
B) Follow below path: Project / Properties / Web
Find Servers section
Click on Drop down and change the selected value between Express and Local
Then Create Virtual directory
Following are some of the options that we can use to solve the problem.
ctrl + shift + r (This will do a hard refresh of your current tab)
ctrl + F5 (This will force the cache to refresh on the browser)
Stop debugging and Change the web.config file and run again
Stop debugging and clean the project, Rebuild it and run the project
In case disabling the cache and editing the web.config file does not work.
Simply close the solution and reopen it and try it. Strange, but it worked for me.

How to deploy Umbraco 5 website

I hope I'm asking this question in the right place. I also asked on umbraco forum, but did not get any response yet.
I'm having problem with deploying my Umbraco 5 website to external hosting.
On local machine, I used Umbraco 5 template for VS2010, which works fine (although it's quite slow).
When I publish to live server I get 500 error.
So far, i've tried installing fresh copy of umbraco on hosting (works fine).
I copied config files in hive provider folder (in App_Data), to point umbraco to my hosting database. That does not throw any exceptions yet. Problem starts when I copy views and partial views over - umbraco then finds the template defined in database and tries to load that.
It's worth mentioning that I also copied my project.dll file into bin directory on the server - the reason for that is because I have added new controller which inherits from surfacecontroller (in /Controllers folder).
Please let me know if I'm doing something wrong.
Cheers
Sebastian
It is not any different than deploying a MVC3 website.
There are quite a few questions with exactly that signature here on so.
Visual studio even has a few tools to help you in the process.
The publish function is found right clicking the project in the solution explorer.
If you use the template for developing, you have a working umbraco solution locally right?
If that is the case, it is easier to just deploy / publish the entire site intead of copying bits into another umbraco solution.
Publish tool
When using that tool, remember that umbraco has quite a few config files etc. and they all need to be included. So it is probably the easiest to just export all files in the folders, by changing "which files to include" setting in publish tool. That will unfortunately include all your .cs files too, but later they can be filtered out of the publish process.
First make it work, then make it awesome :)
The same goes for compilation mode, i have found that release mode sometimes breaks things, so for now just keep it in debug mode.
Then later when you have it working, you can change to release mode for a small performance gain.
Stuff to remember
include all necessary files
change connectionstrings
copy databases
custom errors, you don't want your visitors to see YSOD's with your internal debugging info.
disable tracing and debugging!
After reading this, you should go on and look for other more elaborative resources too.
"umbraco then finds the template defined in database and tries to load that" is key point to me
whatever the version you follow the templates and doc types are the backbones of umbraco ( from you website I know that you are aware with above more then me.. but repeating.) I mean you have created new website but there are no relative Templates and Doctype yet you try to use them in views and subviews and that caused the problem.
To do that please create tempalte and doctype same as is in you staging site and this problem will be solved.
Even better kick-start you development with new site only and make replica of that after defining doc-type and templates to your staging.
I hope i can explain my point.
Thanks,
Jigar
I've had problems in the past deploying Umbraco 5 projects. When you deploy an Umbraco 5 website to a new server and before you switch the website on in IIS, navigate to \App_Data\ClientDependency and delete any XML files that are there. Next, navigate to \App_Data\Umbraco\HiveConfig and delete the ConfigurationCache-*.bin files.
Once you've done that, recycle your Application Pool and start your website.

IIS 6.0 suddenly shows directory listing instead of MVC 3 app

Over night an (internal, luckily) MVC web application has stopped working for me, without anything being changed as far as I know. The application itself absolutely hasn't been tinkered with in the last two days and the same goes for IIS.
The problem is that I get a directory listing of my www-folder instead of the applications default action (/Home/Index).
My www-folder contains the standard stuff:
bin
Content
Scripts
Views
Global.asax
Web.config
I have tried:
setting a "Specific Page" as Start Action but it doesn't solve the problem.
restarting the web page in IIS
enable/disabled "default content page" in IIS. Doesn't help, but IIS does pick up on a Default.html if I place it in the www-folder.
Now, this has happened once before. At the time I was on vacation and it was solved by restarting the entire World Wide Web Publishing Service. While it might work this time as well, I'd rather figure out the root of the problem before temporarily fixing it just to have it happen again further down the road. So while a WWW Publishing Service restart might get the site running again I'd rather understand why it happened in the first place before fixing it this way.
Finally, note that I'm running other MVC apps on the same IIS server and have never gotten this problem with them.
Open Command prompt
Go to C:\Windows\Microsoft.NET\Framework\<version> folder.
Run aspnet_regiis -i
That's all!
A little late.... But as I was receiving the same result.
My Application Pool was targeting the wrong .Net version (should be same as web app Target Framework). Simply adjusted within the "Set Application Pool Defaults" option, restarted and it was solved.
Hope it helps someone.
I had a similar problem.
The IIS root path had been changed by a collegue.
The solution was to fix the "Physical Path" in the "Advanced Settings" of the Default Web Site.
I don't think /Home/Index is possible to run om IIS 6.0 with out any configuration. ASP.NET MVC actually requires "Intergrated Mode", but could be run on classic with applying configuration.
That article by mister Haack, could be helpful: http://haacked.com/archive/2008/11/26/asp.net-mvc-on-iis-6-walkthrough.aspx
Saw this problem when I added a folder called "documents" at the root and also had a DOCUMENTS controller & view. I think it was confused if I wanted the route \documents which is in the CONTROLLER folder or the \documents folder below the root. One solution was to add an id to the route which makes it use the controller version of documents
Url.Action("Index", "Documents", *New With {.id = 1}*)
Can also change the name of the newly added folder below the root to DOCS.
Changing the .NET CLR version of the application pool might help.
Right click on the application pool in which your application is running and select Advanced Settings...
Change the .NET CLR VERSION to the version of your application(same as that in the config files)
Click ok
I had the same problem and here is how I resolved it.
I had a problem with the Global.asax file on the TFS server inheriting from the WebAPI project (and not the web project) although the web project was chosen as the startup project in Visual Studio. When I ran my build the Web API was set as the start up project on the web server since it was deploying the version on the TFS server that was inheriting from the WebAPI project. To resolve this I set another project as the startup project and then changed the web project to be the startup project again in Visual studio. I had to do this since TFS complained that there were no pending changes when I tried to check the version I had on my machine into TFS. I then checked my code in and ran the build again. This resolved my issue.

Disable Visual Studio Web Server Directory Browsing

I'm using Visual Studio's built in web server to test and EPiServer applicaiton. When I have the app running in IIS, if I hit the root of the virtual directory, EPiServer will take over and server the defaul page to me. Using the Visual Studion server (which I am doing for license reasons with the SDK), it always gives me the 'Directory Listing' view of my site. Does anyone know how to configure this web server to not allow the directory listing/browsing?
Additional Information:
This problme only seems to effect the root of the visual studion web server (i'll call it cassini from here on in). As an example, if I run a site from localhost:6666, then what I will find is that localhost:6666/en/ will work just fine and the EPiServer VPP will know what it is doing. If I use localhost:6666/, then the VPP never kicks in (or so it seams). It seems to me that when the root of cassini is hit, it checks to see if the page exists (which it does not as I have no default). If it decides that the page does not exist, then it serves up the directory listing, rather than 404. The first thing to do for me is to dispable directory browsing in cassini, then look at why the VPP is not being actioned correctly.
So I suppose the base of the question is: Is there a way to modify these settins in Cassini when it is Visual Studio starting everything off?
(EPiServer may be a red herring, but just in case, it's CMS version 5)
Further Update
I managed to get hold of the source for Cassini 3.5 and gave that a whirl. 3.5 works just fine and behaves like IIS in this instance. I.e. the lack of default document does not lead to a Directory listing, rather if allows the HTTP handlers to kick in and then EPiServer does the rest! So the question is, can I achieve the same in Visual Studios effort at a web server?
Make sure you have a ~/Default.aspx file. It won't render, but it's needed in cassini for the virtual path providers to get a chance to handle the request for '/'.
Of course, if you make it anyway you might as well use it for the start page :-)
Even if you could get the server to not show the directory listing, could you get EPiServer to take over?
EDIT: From comments
The fact that it works with /en/ makes me think this is something that Microsoft could fix. I suggest you ask the vendor if they have a workaround. If they do not, then please create a suggestion at http://connect.microsoft.com/visualstudio/. Be sure to specify details about EPIServer, URL to the vendor, etc.
Be clear that it works with /en, but you want a setting permitting it to work at the root.
Once you create the suggestion, please edit your question to include the link to the suggestion you create. That way, others reading your question can vote on how important they think this is.
The EpiServer part confuses me. However, if you are asking how to set the default page for the VS development server (based on the Cassini code), you're expected to do that in the project properties (right click on web project), Web, Start Action, Specific Page, foo.aspx.
I suspect the cassini/VS development server doesn't have a default page feature-- the source code for the cassini server (the ancestor of the VS development server) is on the web and you can check that and add a default page by building a custom version. And it doesn't have a very long list of other features that IIS has.
Which EPiServer version are you running?
Did you install it using EPiServer Manager?
There has always been some differences in the configuration between running the site at the root of a host name or as a (virtual) directory.
Check the site settings block in web.config and make sure you have a default.aspx at the project root.

Resources