How to start asp.net application without .sln file

Viewed 598

I have a working codebase of a web application written as ASP.net webform application, Visual Studio community edition. How do I start the application. Meaning how do I start the application / debug,

Community edition IDE expects something like a .sln file which I don't have, or its not present in the codebase.

I have been writing code for more than a decade, but I am new to ASP.net, require some help.

2 Answers

Normally (as you note), you find(have) a .sln file.

However, if you don't, then usually you have (will find) a .vbproj file for vb, or a csproj file for c#. When you open these "project files", then VS will create .sln file for you.

However, the 3rd possibility is this is not a asp web site application, but a asp.net web site (note HOW VERY close the term is I used:

Asp Web site  = (no sln, and no project file)
Asp Web Site Application = (should have a .sln, but you have one if you open proj file).

So, if no .sln file, and no .vbproj/csproj file is found?

Then you have what is called a asp.net web site.

They are VERY close in terms of editing, writing code etc. However, a web site is NOT opened as a project (.sln/.proj) file, but you simple use this option:

enter image description here

In this case, then when you select above option, then you JUST browse to a folder, and you don't have a .sln/.proj file at all. You are in effect just opening a folder that has the web site inside.

I don't have a great/nice link that explains the difference between a asp.net web site vs a asp.net web application.

However, the major difference is:

The Asp.net web application

near ALWAYS expects that you have a dedicated server to publish to (so lower cost hosting will not work).

You have both control over the whole web site features - can write custom page handlers. You have more options for authentication. In effect, you can code and change "base" features of internet services. So, you have direct use of the web server features - and can over-ride behaviors.

Asp.net web site This really is just a sub folder. So, for example, this option can be used to up-load your web site folder to a existing server. And you can modify one page (and code behind), and you really don't have to re-publish. This option of course OFTEN has to be used if you using some low cost web hosting. You can't publish a web app, since it would quite much over write the server features - including the base starting page.

With a web site app? The whole site is re-compiled, and the whole application is compiled down to ONE .dll. (much like a desktop application, of course additional .dll's and libraries can appear as separate .dll's). but, they are usually all merged into one .dll.

So, the existing of .sln, or .csproj/vbprjo files will quite much tell you which type of web site you have.

While a web site app requires a full re-publish of the whole site - even for one small code change - I still prefer that setup WHEN that option is avaible. This is due to having additional options, and control over session() events, and more.

However, as noted, in a lot of hosting environments, you only get a folder and some place to shove up your folders and web pages - and thus full web app publishing will not be a option for you.

@albert-d Fantastic answer!! it led to a lot of development,some how i figured out something.

cd theapp
dotnet new web # Create basic web soln/app
dotnet run

This sort of created default web app on the folder

info: Microsoft.Hosting.Lifetime[0]
      Now listening on: https://localhost:5001
info: Microsoft.Hosting.Lifetime[0]
      Now listening on: http://localhost:5000
info: Microsoft.Hosting.Lifetime[0]
      Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
      Hosting environment: Development
info: Microsoft.Hosting.Lifetime[0]
      Content root path: /Users/raj/theapp/

On the browser it give nice output

enter image description here

But when I try to execute my old files present, like

http://localhost:5000/Default.aspx

Its not working.

Giving following error

enter image description here

Looks like I am losing a battle for want of nail. Could you pls clarify.

Related