Web root folder - www - visual-studio-cordova

Visual Studio 2015 RC has changed the project system to use ASP.net 5 folder structure. The change from previous version is the introduction of the www folder.
I am unable to use site root-relative paths (such as /css/references.css) when linking to external resources. I get "Failed to load resource" error.
Document-relative paths (../css/references.css) work.
For example:
<link rel="stylesheet" href="/css/reference.css" > **Fails**
<link rel="stylesheet" href="../css/reference.css" > **Works**`
Is there a way to use site root-relative paths?
Description of web root for ASP.NET 5
The Web root of your application is the root location in your project from which HTTP requests are handled (ex. handling of static file requests). The Web root of an ASP.NET 5 application is configured using the “webroot” property in your project.json file.

In short: no.
Cordova apps do not stand up an HTTP server on the device to avoid both CORS issues and to ensure a low memory and CPU footprint. Instead it uses file paths and thus has no concept of a "web root". Unfortunately the exact file path varies by platform out of necessity, so you will need to use relative paths.
Also, as a small side note, the file structure in Tools for Apache Cordova projects in VS 2015 RC is actually that of the Cordova Command Line Interface, not ASP.NET. This was done so you can use other command line tools with Cordova projects including the Cordova CLI itself.

Related

Getting HTTP ERROR 404 after publishing ASP.NET application in Azure App Service with Visual Studio 2017

I have an application in ASP.NET Framework 4.6.1 that works fine when running in my local environnent using Visual Studio 2017 (version 15.7.27703.2035).
On server side, the same application is displaying an HTTP ERROR 404.
Screenshot on local environment
Screenshot on server environment
To publish the ASP.NET application, I am using the publish tool of Visual Studio and deploy everything on an App Service of Azure.
Visual studio publish tool and project architecture
I tried to use FTP deployment instead of Web Deploy with no success. I also tried manualy with FileZilla with no success.
Is it possible that some sort of action is needed when publishing a project with custom libraries?
EDIT
What I know:
dlls on server side I actualy have access to the wwwroot folder on server side: this mean I can access js, css, images, etc. But it seems that controllers, views and others folders don't exist on the server..
Libraries issus? The problem appeared when I subdivided my project with the customs libraries CrmDatabaseManager, SysaidDatabaseManager and UserInterfaceLibrary.
wwwroot inside wwwroot on server side A wwwroot folder include anoter wwwroot folder on the server; the first wwwroot folder contains all dlls, and inside it, there is another wwwroot folder containing css, js, images and etc, but no sign of controllers or views.
How I created the project I created the project GPRH
this way using ASP.NET Core 2.0 based on .NET Framework
It turns out that split the project with libraries did broke path references.
I was hard coding the path and there were no problems with that into the main project. When I splited the project with libraries, it caused an error 404.
To access a file in a libary, you need to do this manipulation first:
Right clic on the file > Properties
On Build action, choose Always
copy the file
Then specifie the path this way on the library:
var buildDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
var filePath = buildDir + #"\fileName.json";
using (StreamReader r = new StreamReader(filePath))
{
// code here
}

How to deploy Oracle Jet application to Nginx?

I have an O-jet application and need to deploy it to Nginx.
I have installed Nginx in windows and have it working successfully.
From my understanding, I just need to modify the nginx.conf file and re-load the config file, the application will be available in the specified url.
How to change the nginx.conf since I want to deploy it to specified http://host:port?
Simply copy your OJET project into nginx's web root.
OJET is a JS toolkit, not a web application, so usually, your project files are static content.

Can I bundle and migrate a standalone Aurelia App that can run on apache server without node.js?

First of I am new to Aurelia and has just completed a real world project on my development server which I like to run concurrently with WordPress which needs PHP. Back in the days with angular 1.x I used to gulp all the angular dependencies and scripts into a single file and transfer it to the server, which I thought would be the case with Aurelia too but looks like it is more complex in this matter. So please if any one has come around to this problem, any help would be appericated like how can I port Aurelia project to apache server without serving it through node. Or is it possible to run node and apache on same server.
You don't need to run Node to serve your application. Any web server - such as Apache - will do. You only need to bundle your application and upload the files to your server.
If your project was created using the CLI, the application is bundled automatically every time you run au run (or au build), so you can simply upload the scripts directory and the index.html file. This is the minimum; you may need to upload also CSS, images or fonts, depending on your app.
If your project is based on one of the skeletons, you can bundle your app by running gulp bundle, then upload the distdirectory, the jspm_packages directory, the config.js file and the index.html file, plus anny other asset (CSS, images, etc.) you may need.

Problems consuming webservice on ASP.NET on production(IIS) server

We've implemented some SOAP client code on our ASP.NET site that calls up a remote service. Implementation was basically done by using Visual Studio "Add Web Reference" wizard, adding proper 'using remote.service.namespace' to the code and calling the service.
Code works perfect locally(from Visual Studio), but fails on production web server with missing assembly reference error:
CS0246: The type or namespace name 'remote.service' could not be found (are you missing a using directive or an assembly reference?)
I have a sneaky suspicion that I am not deploying everything properly, maybe some one can point out what is that I am missing there?
Thanks!
Additional info:
Project is a Website.
ASP.NET version 2.0 installed and used as a target on both dev box and production server.
Proxy file generated by WSDL.exe is deployed into the root folder of the website, same folder where the page resides. Global namespace(default) was used for proxy class generation.
If this is a WebSite project, then the proxy file should reside inside the App_Code folder
You mentioned the proxy dll is placed on "the root folder of the web site, where the page resides".
You should place the dll inside the "bin" folder. If the folder is not there create it.
The Web Service client stack in .NET does runtime generation of the proxy client (from the annotations in the class generated by wsdl.exe/svcutil.exe). this generated file typically ends up in one of your servers temp directories (there's one under the main windows tree somewhere). The problem is that the ASP.NET user account doesn't have rights to write to this particular temp directory, but doesn't notice at the time it writes the file, so you end up with an error with it trying to load the generated file back. You can end up in the situation depending on the exact installation order on your server. Once you find the right directory you can simply fix the NTFS perms on the directory to solve the problem.
Did you copy the App_WebReferences folder and all its contents to the server?
Does other parts of your ASP.NET site work?
Does your site target 3.5 and possibly 3.5 is not installed on the production server?
Is this a Web Site, or a Web Application Project? I bet it's a Web Site.

How to run ASP.NET web application using mono?

My department doesn't have a server to host web applications developed in ASP.NET. They do have RHEL boxes having Apache web server, which won't host my ASP.NET web pages. I inquired and they said they have mono which would run my .NET applications.
I created a simple web page and it worked on my windows laptop.
My question is what exactly should I copy to my home directory (has CGI environment) on the RHEL box. Copying dll's won't make sense, so should I copy the .aspx files?
I read a bit about it here http://www.codeproject.com/KB/cross-platform/introtomono2.aspx
They say just copy the .aspx files. In that case how does it all work? I mean does mono compile the .aspx files and makes it compatible for Apache to host them?
Does it have any flip sides like everything I develop in ASP.NET on windows can be shown on linux web server as it is using mono?
cheers
If you are using the Website model, you should copy the whole directory contents (they'll be compiled at run time). If you are using the Web application model, you can skip copying .cs files (the .cs files will be compiled to .dll files in the bin folder beforehand). You should copy bin folder instead, along with all other .aspx, .ascx, .asax, .config, ... files.
Your Apache server should have mod_mono configured or should use xsp2. Copy your ASP.NET code to the a dir on the Apache server and configure the directory in Apache and it should work.
Copying DLLs does make sense since they are MSIL and that is exactly what Mono needs.

Resources