asp.net manual copy to server - asp.net

So I just got a site hosted at hostasp.net. In VS I'm working with a web site not a web application. In the control panel on the host under my site I have folders (data, logs, wwwroot). My current project only has 1 javascript file, 1 aspx page, and a web.config. I placed Default.aspx & web.config directly under wwwroot. In VS my javascript file is in a subfolder named Scripts so I created this subfolder on the host site and placed my javascript file in there.
When I access my site I get "Server Error in '/' Application." error. What am I messing up here?
Also if I have a code behind file, where do I put that? Should it be compiled somehow? When I built the VS project it doesn't give me any dll for it or anything. Right now I don't have anything in the code behind but just wondering for later if I do.

If you are using Visual Studio:
You can certainly just copy the files to your live server. Your "code behind" files will be compiled at run time.
You can Publish a Web Site or Web application so you have the option to pre-compile (to dll) all your code (and will be in /bin folder).
If you want to remove the "guessing" of which files you need to "push" to your live server. You can publish to your local file system or directly to FTP. VS will pre-compile your Web Site or Web Application, and "collect" all the necessary files that make up your web site/application and save it in the folder/FTP site you designate.
If you chose to publish to file system, then all you have to do is copy/ftp (whatever) to your live site. You might ask why even publish to local (first) only to FTP it anyway? So you can get fully acquainted with how all of this works - the different publish options, etc. locally (which is essentially the exact structure of your production site).
Publish Web Site (VS):
Publish Web Application (VS):
The only time this may not work is when your host doesn't have the "bits" that you might have. E.g. not all hosts may have the latest/greatest from Microsoft, like say, Web API and all the assemblies it entails.
But again, the tooling can help with Add Deployable Dependencies...which does and when you publish, the dependencies are all "bin deployed" (meaning they'll be in the /bin folder):
Hth...

Related

ASP .Net Web App not publishing .cs files and Database

I have a web portal app. I built it in Asp .Net. The app is now ready but when I try to publish it using Visual Studio, I only get the .aspx and .css files. It does not include the .cs files that have all the backend code and functionality, and it does not include the database either. The method I used for publishing the app was:
Right Click my project -> Click on Publish -> Select IIS,FTP,etc -> Select File System and provide Target Path -> Click Save.
It published the app at that targeted location. But, when I open that folder, I can only see the .aspx and .css files and no .cs files, as you can see in the following screenshot.
https://drive.google.com/file/d/15pecp8tbamjlWCm4rfV6M_zeW7zdUUB9/view?usp=sharing
At first, I thought maybe this is how it publishes the app, as this is the first time that I have tried to publish a web app. Therefore, I loaded it to IIS as it is, and tried to browse it. When I browse it, it loads the first page, that is a login page, correctly. But when I enter user credentials and try to login, it provides me with following error:
https://drive.google.com/file/d/1TIC0gE1tFpcne4bXaSsEVm8yiOPnIyOt/view?usp=sharing
I have underlined the lines by which I got the idea that the error is related to database and .cs files.
Please, if anyone can help me about this, it will be really appreciated. I have a deadline and I dont have any idea that how can I solve this problem.
Thanks.
When you publish your web application the visual studio compiles all your your cs/vb/class code into binary files (dll), this dll files can be found in your site bin folder, so you can't find the .cs file.
There are many causes of the network path was not found which are given:
1.Antivirus 2.Firewall 3.SQL Server Network configuration.
and please check if you have the port in the connection string "Data Source=x.x.x.x,1433".
More information about this error you can refer to this video:Resolving SQL Server Connection Errors
For a web application your .cs files are compiled into a DLL which will be in the bin folder.
The special App_Code folder can be created and the .cs files in there will no be compiled during publish and will be compiled by IIS on demand.

From what parts does the built Asp web forms application consists?

Can't google with a success an info about: from what parts does the built Asp web forms application consists? In a Debug folder I see only dlls, but as far as I understand the aspx pages and a web.config file should exist. Any links?
The BIN folder contains the compiled code behind. The ASPX pages and web.config stay in the same place, the root directory of your application.
Further reading:
ASP.NET Web Project Folder Structure
How to: Publish Web Application Projects
Asp applications, unlike windows forms applications need to be published first.
Right click on your project and click publish. From there pick file system option and publish to wherever you want on your computer.
Those files are the ones you upload to ftp server.

Where does IIS look for files

Can anyone explain, please, exactly how .net works. I create a web site in Visual Studio and publish it to a local server to a folder at
D:\WebSites\Project1
I create a web site in IIS and provide the address of the folder containing the files for the web site. When I publish the site, using 'fixed naming and single page assemblies', all the .aspx files go in the folder on the D drive and a dll for each page goes in the bin folder inside that folder.
I would assume that when someone wants to view a page in their browser, IIS retrieves the file(s) required from the folder specified, they get processed and turned into html and sent to the browser.
Recently when someone clicked a button on a page that calls a web service - a file not found error was reported. Apparently
C:\Temp\bx5tn2js.dll
could not be found. The thing is - why did IIS decide to look in C:\Temp for a file?
And, in the error message was a load of references to xml serialization. What is being serialized?
This file looks like the compile files that asp.net generates on compile.
This folder can be setup on web.config on compilation session with the
tempDirectory="C:\Temp"
If you do not have set this option asp.net is use a default folder that is usually inside the asp.net directory, inside the windows folder. But if you have set this, and this folder did not have the correct permissions, then asp.net fails to compile the project, and you can get a message like that.

Working with .asp and .aspx pages

This may be the wrong place but this is new to me. I did some ASP.NET programming in VS.NET awhile ago and I always did debug in the menu to run and test the site and I always noticed that it compiled ... now I have someone having asking me to work on their ASP.NET website and my question is (new to this type of hosting) do I just edit the files and then upload them via FTP or do I have to ask the host to do a compile or something?
I'm assuming you have developed a project in Visual Studio.
If this is a Web Site and not a Web Application:
Right click the project (not the solution) in the Solution Explorer.
Click "Publish Web Site"
Set the local location of where you want the Web Site published to.
Take the local copy and upload it to your web root of your hosting provider
If this is a Web Application, check to see if the hosting provider has a .axd service extension for "One-Click Publishing". If the provider does not have this feature:
Right click the project (not the solution) in the Solution Explorer.
Click "Publish..."
Change the Publish method to "File System"
Set the Target Location and click Publish
Take the local copy and upload it to your web root of your hosting provider
With Web Applications you also have the ability to upload via FTP, which if you have all of the FTP information at hand it should be easy enough.

IIS 6.0 web application - Does the entire "website" need to be an "application"?

I had a website hosted in IIS. One small section of it needed asp.net. So I just right-clicked that section/directory and made it an application and a virtual directory.
Is that alright? Or does the entire "website" need to be made into an application and virtual directory?
The reason I ask is that when I try to browse to the aspx page in this "application", I am getting a parser error message "Could not load type...MyCodeBehindType" in the page directive, which seems to me to indicate that it is not finding the dll's, or even the code behind class files (which are clearly in the same directory).
EDIT:
If I do it this way, with only a subfolder of my website actually being a web application, where do I put the dlls? In a bin folder of the website the web application is within? Or in a bin folder of the web application?
Making just a folder within a website, an application, should be fine. I usually have to remember to change the version of ASP.NET from 1.1 to 2.x, that may be what's causing the error.
In order to test the configuration, start with a blank test page (blank.aspx) with just HTML. If the HTML shows up, you know IIS is serving .NET pages.
If there is a problem with ASP.NET not being correctly registered for IIS, you could try re-registering it. Open the following folder:
%WindowsDir%\Microsoft.NET\Framework\x.x.x\
and run:
aspnet_regiis.exe -i

Resources