I can easily write an asp.net code. I hit the visual studio RUN button and I see my website in Chrome or any other browser. But how do I do this without visual studio? I don't get an exe file, only the dll. I think, this must be copied somewhere.
Idea is to run (any) programm, which causes a special page to show my website (with OPC-data) on a local computer. Like an exe file.
To give more detail: I want to run some Web site code in a CEF (chromium embedded framefork) so that it looks like a normal executable. It will run only on a local computer (in fact a machine). This is static. But some information have to be provided dynamically by an OPC client. This will be read with VB and displayed via ASP.NET. The first application reads the data via AJAX. So I think what I need is some kind of local server (like wamp) which has to be started in the background. I found a batch file to start WebDev.WebServer40.exe. But this could not be the right way. A batch file sounds like stone age.
-->c:\Program Files (x86)\Common Files\microsoft shared\DevServer\10.0
You have IIS Manger installed, yes? If not, you can go to Control Panel \ Programs and Features and turn this Windows feature on. From within IIS, find the Default Website node and underneath that create a new application (this way it inherits the correct permissions). Point the application's start path to wherever your web app lives on your hard drive (the root folder that contains your app's web.config file). Anyway, that's one way to deploy your app locally.
Related
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.
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:
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
But when I try to execute my old files present, like
http://localhost:5000/Default.aspx
Its not working.
Giving following error
Looks like I am losing a battle for want of nail. Could you pls clarify.
I have an ASP.net that I built in VS2010 running in iis7 however when I go back into VS and make updates to the code behind file and re-publish the application still acts as it has before I made the changes. I have tried deleting and republishing all the files and restarting the app pool but it still doesn't affect how the application behaves.
project-->Property's--> Package / product web--> Items to deploy --> All files in this project folders
now publish your project.
your new files also added in publish folder. . .
DO NOT publish your vb and cs file on there server unless you feel like having your source code potentially exposed. There have been multiple vulnerabilities that have allowed code download.
Publish the application to a folder via the visual studio publish menu.
On the server, go into your temporary aspnet folder for example:
c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files
and find your app and delete it. If you cannot delete the files stop the worker process (w3wp.exe) or restart iis.
Republish and all should be good. If you are in doubt if that version is getting executed then add some logging in the new version or trace information.
There are two options for publishing an ASP.NET site to a server:
Copy the .aspx AND aspx.vb (or .aspx.cs) files to the server. The first user to hit the server causes compilation so it takes a little bit of extra time for them. Once that's done, subsequent hits should not be impacted.
Copy just the .aspx files - and a compiled DLL to the server. The DLL contains the compiled code so it doesn't exist on the webserver. The first user does not have to wait for compilation and the VB or C# source code is not on the server, potentially accessible to hackers.
It sounds like you've compiled the site to a DLL but that DLL isn't getting published to the server when you re-publish. Have you recompiled the site before publishing?
I faced similar issue with WPF single file exe publish.
while debugging from VS my changes were visible.
But when I pasted the exe to deployment folder, the changes weren't there.
I had to change the version number to see my changes when I run the exe from the deployment folder.
I may have to do with how single file exes are handled. The extracted cache may not be getting updated.
I have built a few custom applications that run on WSS 3 using the Visual Studio 2010 Web application template. When I compile the application, Visual Studio creates the assembly file in the bin directory which I copy over later to the production server (another machine) with WSS 3. The compiled application dll file is copied into the bin folder inside the virtual directory of WSS and runs fine in there.
As the project requirements / applications grew over time I now face the problem that the first hit on the assembly triggers dynamic compilation which I would like to avoid.
Even if applications are running fine I would like to use the asp precompiler on my development machine in order to reduce the delay when the page is first requested.
I have used the following command to precompile the entire Web Application:
aspnet_precompile -v / -p PATH_TO_WEB_APPLICATION C:\WebApp -errorstack
The compilation runs fine without any errors and I end up with a couple of .compiled files and also a Web_App_xxxxx.dll file inside the C:\WebApp\bin folder.
From here onwards I am a bit lost on how to proceed.
Could you please give me some advise to which folder I need to copy the compiled files on the production server ?
Do they need to go into the bin folder on the server or better into the folder where the aspx pages are located?
Additionally I would like to know if I can precompile the Web application on a development machine without the IIS metabase using the -v and -p switch and later use it inside WSS?
I copied all files from the C:\WebApp\bin folder to the server bin folder but unfortunately the csc compilation process still kicks in when looking with process monitor at the server events.
Cheers,
Mathias
The files just need to be dropped into the bin folder and everything will work fine. As for the -v switch you do need to have it if you're using the -p flag, but I think it depends how you're compiling the app too. Check this link out for more. I don't believe its a big deal if its wrong / incorrect though.
This kind of scenario sounds like a job for Cruise Control .NET environment.
I found an answer to this precompilation question:
I thought the first hit on the application page takes a long time because asp.net needs to compile it and I can save some time by precompiling. The application runs inside the WSS context and enables the user to go to a web form and update through the form his/her Active Directory profile. The Exchange global address list is also updated on the Exchange forest so the changes are visible through the Outlook address list and also on Communicator.
The complete solution code with reports etc is around 6000 lines of C# code.
My assumption regarding slow compilation due to the amount of lines was wrong.
I downloaded the following hotfix for asp.net:
http://support.microsoft.com/kb/961884
and set optimizeCompilations="true" in the web.config as explained here:
http://blogs.msdn.com/b/davidebb/archive/2009/04/15/a-new-flag-to-optimize-asp-net-compilation-behavior.aspx
http://www.paulliebrand.com/2009/09/18/sharepoint-development-to-bin-folder-and-extremely-slow-render-initial-render-times-solution/
Now the first hit on the application is much faster.
Many thanks,
Mathias
I have an ASP.NET application which I'd like to try running on Mono, just as an experiment. When I bring the application as it is to Mac, start xsp2 on the directory, it runs as I would imagine it should. That is, it crashes on because of the file system path differences (\ vs / in directories).
This is where I would like to open it in MonoDevelop and fix the problems. But since it was website, it doesn't have .csproj file. And it seems that there's no .sln file either, since Visual Studio stores those to some random directory by default. In Visual Studio you could open the project with Open -> Web site... -> Local IIS etc., but I see no such thing in Mono.
Is there a way to open a directory as a web site or somehow generate the .csproj file? I would prefer an answer which won't need Visual Studio or even Windows to help me with that.
Create new project in MonoDevelop in the same directory as your files.
Right click the project in the solution window
Choose Display Options -> Show All Files
Right click a file and choose Include to Project
You can select multiple files at a time (shift or ctrl click) and include them all at once, or include full directories.
Unfortunately you can't open WebSites in MonoDevelop. WebApplications are supported in MD, but WebSites aren't. Michael promised yesterday that he will explain why, you can ping him to touch this topic quicker.
Some more information is available:
http://mjhutchinson.com/journal/2008/08/15/web_application_projects_md_and_vwd
http://mjhutchinson.com/journal/2007/06/04/rethinking_asp_net_project_models
http://mjhutchinson.com/journal/2006/06/10/asp_net_project_models
Probably, in the long run, the best solution for you will be to migrate from WebSite to WebApp.
One option to avoid changing your application settings is to use Mono's built-in path remapping feature, basically do this:
$ MONO_IOMAP=all
$ xsp2
For more details you can read:
http://www.mono-project.com/IOMap
Create a new project in MonoDevelop and import the files into it.
When I use Build->Publish Web Site in Visual Studio 2008, most of the time it compiles the site, and then simply asks me "All files in the target folder will be deleted. Continue?" (or something to that effect). On occasion, however, when publishing a project in Visual Studio, I would get a dialog box that would give me the choice of replacing the folder's contents completely, or simply replacing changed files with newer version.
I much prefer to publish without completely obliterating the folder, because the deployed application creates user files and cache files as it's been used that I don't want to take extra steps to preserve. However, I'm not sure why Visual Studio doesn't always give me this option. Is this a setting somewhere I can change? Is it tied to the version of .NET I'm using?
Any insight is appreciated!
Edit - Followup on 2009-01-20
I still haven't figured this out, but here's some more information.
Here's what the publish function looks like for one ASP.NET project on my Win XP desktop:
And here's what it looks like for a different project on my Vista laptop:
Notice the radio buttons in the second screenshot that allow me to choose to either delete the contents of the folder prior to publishing, or merely to overwrite matching files. I'd like to have these options for every project.
Both computers are running Visual Studio 2008 Professional (version 9.0.30729.1 SP, according to Help->About). The exact same version. And I doubt the OS difference is causing this functionality change. It's got to be a setting somewhere, right? Does anyone know?
John is right, the only difference is one of your projects is a Web Site Project and the other is a Web Application project. You will not see the "convert to web application" option unless you are in a Web Application project. I know... it is very misleading. The reason behind this stems from the the way you convert to a web application project. If you plan on converting it(which can be a real pain in arse, depending on how it is set up) then you need to be aware of a few differences:
In a Web Application project everything is pre-compiled all the codebehind pages will be compiled into a .dll ---- In a Web Site Project nothing in the project is pre-compiled, the compiler will compile everything to ensure it is valid but none of the compiled pages are uploaded. When a user first attempts to access the site each page is compiled into its own dll. This means in a Web Site Project you are able to upload a single codebehind file.
Namespaces - In a Web Application project namespaces are created by default in a Web Site Project they are not. So you may have to spend some time adding them if you plan on converting them.
Project files - you will notice that A Website Project does not have a "cproj" file a Web Application project does.
I have converted a few of these project I find they go fairly smooth as long as there is not a lot of code in the "app_code" folder. You can give it a try and see how easy it is, if it looks like it is going to be a pain, I would suggest FileZilla just FTP it and save yourself some headache.
Good Luck
That dialog is different for Web site projects and Web application projects. In my MVC projects (Web application projects), I see the additional options. In my regular ol' web site projects, I see the first dialog posted.
Not sure if this option will be suitable for you but you could use the copy website function from the solution explorer. Click on the "Copy Website" icon at the top of the solution explorer.
I think the real answer to your question is that you should put your user files and cache files somewhere else.
When publishing a web site Visual Studio is designed to make sure that the target folder contains your web site files, and absolutely nothing else.
Apparently this feature is coming in VS2010 - that's what Vishal Joshi announced at TechEd EMEA in session "PDC307: Microsoft Visual Studio 10: Web Development Futures"
The site has been updated from the site in the updated layer.