C# .NET console application opens web browser when debugging - asp.net

My C# .NET console application opens my web browser when Debugging, as well as the console itself. How can I set the project such that only the console opens, and not the browser?

The issue is being caused by the project type GUID of the project file still being set to a web application, even though the project output is set to "Exe".
The .csproj file (not the .csproj.user file) will need to be manually edited to change the project type GUID to {36761217-1D8E-4C0F-9A00-B86D9D12B086} so that Visual studio will recognise the project as a C# application and not a web project, and will therefore not attempt to open a browser when the project is debugged.

Related

Application 'D:\home\site\wwwroot\' was recycled after detecting app_offline.htm - ASP.NET

I am working on a .NET project that I publish on Microsoft Azure.
When I publish the app, I see some termination in log files. In particular, the first one is:
Application 'D:\home\site\wwwroot\' was recycled after detecting app_offline.htm.
I have no app_offline.htm in my directory in Visual Studio.
So I am publishing the application, and it immediately terminates, hence stops working.
How do I fix this?
Please check your .csproj in Visual Studio, because it probably holds the setting you're looking for. One of the properties you can set for Web Deploy (MSDeploy) is EnableMSDeployAppOffline, which seems to default to true.
This is causing the app_offline.htm file to be created. Set the EnableMsDeployAppOffline value to false if you don't want to take the app offline when publishing.
Also, taken from Visual Studio publish profiles (.pubxml) for ASP.NET Core app deployment - Compute project items.
When an ASP.NET Core project references Microsoft.NET.Sdk.Web in the project file, an app_offline.htm file is placed at the root of the web app directory. When the file is present, the ASP.NET Core Module gracefully shuts down the app and serves the app_offline.htm file during the deployment.

Difficulty with Converting a WebSite to Web Application and Testing

This is not as straight forward as I had hoped.
I created a Web Site project on my development machine using the Visual Studio C# template for a WebSite Project. (Visual studio 2010 .net 4.0). The project name is C:\Nova5\WebSite3. It consists solely of:
the Bin subdirectory
Nova.svc file
web.config file
It has been tested to run correctly by:
Setting the website as the startup project, then
Run Debug-->Start Debugging
When tested, the NovaDataService information page is correctly displayed. It also correctly works when used through my client project.
I followed the recommended procedure described at
Walkthrough: Converting a Web Site Project to a Web Application Project in Visual Studio to covert the Web Site to a Web Application.
I now have the following problems and/or difficulties:
If I use the recommended procedure for testing the web site:
-- File | Open | Web Site
-- Build Web Site -- Start Debugging
I get the Error: The type 'Nova5WCFServiceLibrary.NovaDataService', provided as the Service attribute value in the ServiceHost directive, or provided in
the configuration element system.serviceModel/serviceHostingEnvironment/serviceActivations could not be found.
Since, I think, the WebSite does work, I skipped this error and moved on to the next part of the article. The next issue (?) is there is no App_Code file in the WebSite. Is this necessary? If it is necessary, how should I create it? Or do I need to create another WebSite project from its template just to have it?
I did not copy the Nova.svc nor the web.config from the WebSite to the Web Application as none of the references I read indicated to do so. Should I copy these files to the Web Application as well?
I now used the "Convert to Web Application" on the Web Application project and recompiled the solution. Everybody is happy. No errors reported. So how do I now test the Web Application project on my development machine (which also has the client application) ?
TIA

Issue Related to Virtual Directory in IIS

I am new to ASP.NET and IIS stuff
I have a Web Application in MVC Framework..
i wanted to create a virtual directory for this application in my local machine.
so i added in iis using "Add Virtual Directory.." and given physical path..
but my problem is- when i change code in .cs file from visual studio, and hit refresh in browser without buid in visual studio - broswer doesn't reflect the result...
So is it necessary to buid an application after change ? or is there any extra settings required in iis to reflect the result in browser without build...
Thanks....

ASP.NET - Change from Web Application Project to Web Site Project

I am new to Visual Studio and ASP.NET. I have a MyClass.cs file under App_Code directory, but could not able to run the function in the class file. Keep getting this error:
The name 'MyClass' does not exist in the current context
I know that code works fine since I posted the codes and others confirmed it works, but I am still receiving the error above.
I read alot more threads on the NET and somes indicated that problem is using Web Application Project instead of Web Site project, which the class file would not compile. I am not sure if I've created it under Application Project we Web Site project.
How can I tell that my site is running under Web Application Project or Web Site Project? and How can I change it to Web Site Project so my class can be recognized.
Thanks in advance,

problem with asp.net website project

I've an asp.net web site project in Microsoft Visual Studio 2010. the thing is that i need it all to copy to a flash drive, and than later to open it as simple in browsers/
I published my project to my drive, and tried to open my .aspx pages with Internet Explorer but i got some error. I really need to do it, urgent.
Somojon: You can't just open an asp.net page using a browser without having the web server (IIS, most of the time) process the page and spit out HTML that can be rendered on a browser.
You can copy the whole project (as Mrchief said) to your flash drive but before you attempt to open the project from your flash drive, you need to copy it again to a computer and configure IIS (or another web server that has support for ASP.NET).
I imagine you think you can do this because you can run your project with Visual Studio, but that's because Visual Studio comes with an the integrated web server that process the ASP .NET code and spits out the HTML to display on your browser. Bottom line is that when you move your project to another computer you will need a web server to serve your ASP .NET pages.
Copy the entire solution folder. Publish is not going to help because that publishes files that are needed to run the site, not the whole project.
This is not going to work, you should have a web server to run your ASP.NET website, IIS, IIS Express or other ASP.NET compatible web server which should execute the compiled assemblies and serve the pages to the browser.
if you simply open the pages with a browser without having a server processing them, nothing executes.

Resources