Azure Web Job Resource Deployment - web-deployment

I created a web job which loads a text file from disk
My problem is that i get a DirectoryNotFoundException whenever this job executes.
I have a Resources directory and a text file in my web job project
And it work well when i run it locally.
When remote debugging i can see the active directory is D:\local\Temp\jobs\continuous\EdisonContinuousMailJob\5rvo4ggm.rqa
And it contains all the dll, pdb files required for my web job but missing the Resources folder.
How can i make my resources deployed together with my web job ?

After doing more research i found this question, and the answers suggest that this is a bug and offer a workaround.
For my purposes i embedded the text file in the .Net assembly following these instructions,
and this works well for me.

Related

How do I properly deploy a website from Visual Studio and make this ASP based site function properly?

I'm sure there's something simple I'm missing.
I'm attempting to help a buddy move his ASP site from one host to another to avoid some questionable billing practices. I usually work with PHP-based sites (Wordpress etc.) and, unfortunately, have no experience with VS or ASP.
He's temporarily moving to Godaddy on their Plesk offering temporarily until he can work out something else. He provided me with all of the files contained within his ftp (containing his site's default.asp file, header, footer etc.) as well as an archive.xml, parameters.xml, and a systemsinfo.xml file. No .snl file or anything like that.
The files did not come with a web.config file. The error I keep getting, after uploading the FTP files is "HTTP Error 502.5 - Process Failure". From my understanding, it's often related to the web.config file. And from what I understand, you can have one generated by deploying the site through VS. Problem is, I'm at a loss as to what the proper actions to deploy this project.
Plesk provides a .publish settings file, I'm just at a loss as to how to properly open this file in VS to then have it create a "web.config" file and proceed to have it publish to the hosting. Part of this is I'm unsure how to properly open a project like this in Visual Composer to then proceed with the process of setting a web.config file and going forward with the deploying.
Not knowing exactly how to open this project without an .snl file or anything, I tried creating a new project and dropping in the other files to try and set up the process that way with no luck. Considering that Plesk provides a deploy file with that information, I'm assuming if I can properly open the project, working locally, I can then go through the deploy process. I'm just at a loss as to how I can properly setup a new project with someone else project files without an .snl file or otherwise.
Any guidance that you provide would be awesome.
Thank you.
Well, if you missing basic files required to operate the site such as web.config, then you don't have the site or files required, right?
Either FTP down the existing site, or you go to the source code and VS project, and re-compile the code, and re-publish. In fact, I suggest publishing to a local simple file folder.
Even publishing to a local file folder is a good start. Now, just copy that local folder that you published from the source code project, and that published folder should work on the new site. But, really, missing files like web.config? Rather fundamental that you have ALL files of that existing published site, or you have to go back to source code project in VS and re-publish.
since that site has vb.net or c# code? Then it also not clear if the original site was a
asp.net web site
or
asp.net web site application.
Rather critical you determine the above. The reason is that for a asp.net web site application, then at publish time, all code is complied at publish time, source code is stripped out, and then you have a working site.
If this is a web site (not web site application), then all source code is in fact published to the web site, and IIS is now responsible for compiling the .net code.
but, gooly, without a web config file, you simple don't have the files for that site to work - NOT even close!!!
but, as noted, if you have the original source code and VS project, then I would of course use the source code project for the publish. As noted, you can publish via FTP, and several other ways - but I in most cases use folder/file publish to a local folder, and then that is FTP up to the site.
You also don't mention if a database is involved. But, the connection strings to the database will FOR SURE change on the new site - and that boatload of required information will of course be in the web config file.
So, what road will much depend on if you going to download the exiting site, or your going back to the original source code and Visual Studio project.
So, first step - which will take about 10 seconds of your time is to determine if this is a asp.net web site, or a asp.net web site application.
If the existing published site has the c# (or vb.net) source code, then this was/is a web site.
If the existing published site does NOT have the source code, then of course this was a asp.net web site application - and Visual Studio is responsible for compiling the code BEFORE publish.
I guess this really comes down to if you have the source code and the original project used to build the site in VS or not?
I mean, if you have the source code (not compiled) of that site and have the full project in VS, then that's your best starting point. And if that site was published asp.net web site (application), then FTP and downloading the site WILL NOT get you a working asp.net project in VS.
This is much like saying you have a some .exe program, but don't have the source code and project used to build that .exe.
Same goes for asp.net. but, as I stated, often the web site as opposed to web site application model is used, and in that case, then you would get and have the source code files by a simple FTP download. But, you don't even have the web.config file - and that makes no sense at all, since that going to exist in the current site if you download, and it would exist in the original VS project used to create that site in the first place. During a publish, we often have an additional config file that has the local database connections, and during publish, they are transformed into the correct database connections for the published site. But then again, you not even noted or mentioned if a database is involved here.
I mean, if I was handed a LAMP project (Linux, Apache, MySQL, PHP), and had to publish that site? gooly, I not worked with LAMP, but I'm sure it would be a week, or more for me to figure that out, since I'm not familiar with LAMP, and how such sites are laid out, let alone how the configuration of such a site works. Big job if the whole system, programming language and framework is something you never used before.
I know that Godaddy use Plesk control panel too. But you need to make sure that Godaddy has support .NET Core. You may refer to this post https://dotnetblog.asphostportal.com/how-to-fix-error-502-5-process-failure-asp-net-core/. I believe it will solve your issue.

Reasons for : xxx.aspx has not been pre-compiled and cannot be requested (it is pre-compiled)

hoping someone has some insight into this issue I get pretty commonly.
I have an ASPX Web Application that is pre-compiled. I have this application running within another IIS application working flawlessly. The parent application has an "updatable=false" property within the PreCompiledapp.config.
Now I need to add more pages to my application, which I create the same way in visual studio, and publish them with the rest of the application. When I open these files to check them in notepad, I can see the "This is a marker file generated by the precompilation tool, and should not be deleted!" as well as the .compiled file that generates with it.
On a local machine and application instance, this works... but when I copy the same applicaiton build to a client (same application, same pages, same everything) it gives me the " xxx.aspx has not been pre-compiled and cannot be requested " error.
What could be some causes of this? The pages are pre-compiled so I'm wondering if this can be thrown for something else. Any help is appreciated thanks!
I think the cause may be the parent application is set with updatable=false but the ASPX Web Application which you published is allow update. So it may lead to this problem. The same error message and the cause are described in detail here.
To solve this problem is convert your application to web application(has its own AppDomain and configuration) or publish the root application as updatable as well.

Deploying a Visual Studio website vs web application

So I'm using visual studio 2010 to build a website that was formerly running on PHP, so I'm pretty new to the environment.
In starting the project I built a website project, not a web application project. I know that will probably generate a lot of "never use a website project, use a web application project instead" comments, but bear with me.
I'm attempting to provide our server team with the necessary files to compile on our server for the first time. However they're used to working with web application files, not website files.
Normally they are given the source code and a batch file that compiles the code into deployment directories and then they just move the files to the server from there. I'm pretty sure that the other teams use deployment packages to do this, which obviously isn't an option for a website.
My question is, what would be the equivalent steps for getting the source for a website ready to deploy vs a web application? I have published the website to a separate folder and this has rendered what I think is the equivalent in many ways, but I wanted to make sure.
Also, is it possible to publish certain parts of a website without others?
Please with-hold all the comments about how I should be using a web application instead, google seems to assume that's all that's used out there too.
Thanks!
There isn't much to deploying a web site other than copying the source files to a directory in IIS. It will compile the site automatically on the first page request.
I agree with Britton. I personally prefer web application but with the web site project you have 2 options.
Either a) Upload all the files (including the .vb or .cs files) and the web server will compile on the fly. OR, you can publish to a separate folder locally on your machine, and then upload that folder. I would do the publish if you don't want anyone seeing your source code.

Change I make to code behind not updating when I publish my web application

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.

Uploading issues with an asp.net website

I have created my first website using asp.net 3.5 .
I have used App_Code for managing my source code files.
Now, after completion:
List item
What needs to be uploaded to the server ?
Do uploading all file including webforms files, source code files make any sense ?
Please provide your own suggestions apart from these.
You should look in to one of these several very good tutorials and articles about deploying ASP.NET applications.
How to Deploy ASP.NET
15 Seconds: Deploying ASP.NET
Deploying ASP.NET Applications on IIS 6
Deploying ASP.NET Applications
Now to your thoughts on what should be uploaded and what not. If you understand the asp.net cycle and how the files are processed by the webserver, it would be easy to know that all files need to be uploaded. But since this is your first application you probably don't have that knowledge.
So, to save you some reading time, Upload everything. In older versions such as 1.1 you had to compile all your source-code into binaries, which you don't have to anymore, but you can, it's up to you.
I However prefere to upload all the files without compiling it to binaries, makes it easier to manage once they are on the server.
The webserver will upon request ( first request ) compile these and then use the compiled files on other requests, this is the short answer anyway, this is why the load-time is longer the first time and the other times it's ( suppose to ) go faster.
Also, worht to know is that if you change the web.config, the application will re-compile.
So just drag n' drop em' to your webb-location and start playing!
If you are using the App_Code folder, it sounds like you are using a web site project type. In this case, the easiest thing to do is just xCopy all of the files up to the webserver. IIS will then do Just In Time compilation (JIT) the first time a page is hit, and will compile your code on the fly.
rgds,
Paul
All content files (i.e. aspx, ascx, asmx, asax, js, css, htm, jpg, gif, png) and DLLs need to be deployed to the server. I recommend using the Visual Studio "Publish..." option on the Build menu to do this for you. It can deploy to a folder (which you can then copy to somewhere else if you like), an FTP site or to an IIS virtual directory.
Uploading your .cs or .vb files is not necessary. It will still work if you do but it's probably safer not to. There's a remote possibility that IIS will have a vulnerability or a sysadmin will make a mistake and your source code will end up being served to the public.
In Visual Studio you could could do File -> New Web Setup Project and build an MSI to do it. This article and This article have more details on this option.

Resources