I have a .net4 web api that I published to azure site, in my development environment, I have a file (data.csv) that I reference to for small checking type of action, I put it under C:\Program File\IIS Express folder and it works. So where should I put this file on the azure web site?
I see there are the following folders on the web server:
/site
deployments/
locks/
wwwroot/
bin/
Content/
Scripts/
Views/
I tried a few places, but no success, so where should I place this data.csv file?
In content and reference it as "~/Content"
What you are probably doing is using Directory to get current directory which takes the path where the application is running. If you didn't use IIS it would probably be in bin/Debug/etc
Related
I'm testing out Blazor WebAssembly and I'm hung up on one detail of deployment. I'm using the VS 2019 sample app, and deploying it to Firebase Hosting. It works, for the most part, but I can't figure out how the auto-generated web.config file should fit in.
When I publish the app to a local folder (call it dist), the contents are one file (web.config) and one wwwroot subfolder (where everything else goes, including index.html). If I deploy the entire dist folder, as expected the website cannot load on the internet because there is no index.html in the root. Conversely, if I deploy just the wwwroot folder, it can be loaded via the internet, but since the web.config file is missing, I get some issues with pages loading. I'm assuming that's because the rewrites contained within web.config are missing.
So my ultimate question is, when hosting in a non-IIS environment like Firebase, where or how does the web.config file, or its contents integrate?
I have several asp.net web services is running in IIS. Now I want to move to another server in all exactly same IIS setting and using same web services. I know about copying a IIS config files(ApplicationHost & administration) to new server remotely but do I also need to copy all asp.net files to new server as well? If yes then must the asp.net files be in the same file path directory as the current one(D:\Website) for IIS in new server to be able to recognize it?
Yes, you would need to copy the ASP.NET files as well.
It is not necessary to put them in the same file path directory. Whatever directory you put them in, ensure your IIS Website Settings point to that directory and you have setup the same set of permissions etc. on it.
e.g. You could have had a website on c:\site on one web server. you could move the website files onto another web server and put them on d:\newsite\ and change the Website Directory Path in IIS Manager to point to D:\newsite\ directory.
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.
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...
I have a web service implemented in ASP.NET 2.0 and have pre-compiled it using the aspnet_compiler.
I have no clue now how to deploy it to IIS, can someone point me in the right direction? I am using IIS 6.0 on a Windows Server 2003 machine.
I have placed the pre-compiled files into a virtual directory, when I access the service through the browser I get the following parser error message:
Parser Error Message: The page must have a
<%# webservice class="MyNamespace.MyClass" ... %> directive.
I then checked the .asmx file for said directive and the contents have been changed by the compiler to:
This is a marker file generated by the precompilation tool, and should not be deleted!
UPDATE: When I place the non-pre-compiled web app in the virtual directory it works fine, when I place the pre-compiled wen app in the virtual directory, I get the above errors.
Anyone have any ideas!?
You can either copy the contents of the output directory into the virtual directory on IIS and it should all just work. You will need to set up the App Pool and configure the virtual directory for ASP.NET just like a non-compiled website. Make sure you delete everything from the virtual directory (if there was a previous non-compiled site there).
Also you can use Web Deployment projects, which can serve as an input to an MSI installer.
The ASMX file contents are correct. Are you sure you have configured the Virtual Directory with an Application? Open the properties window by right clicking on the virtual directory and ensure the "Application Name" (on the "Virtual Directory" tab) is set and is editable.
Also have chosen the correct ASP.NET version on the tab? Check this on the "ASP.NET" tab of the properties window"
did you deploy the entire bin directory? You need to make sure the .COMPILED files created by aspnet_compiled are in your bin dir.