Azure vue issuse with missing server.js/app.js? - azure

I am new to web development and I have tried to upload my vue app to a azure web app service but i am getting some problems
so when I try to try to open the webpage up it says
"You do not have permission to view this directory or page."
I have been trying to follow a few guide about a web.config file, and when i added it, the message disappered, but now it shows nothing. Then i tried to take a look at my output when i try to upload my code, here it says
missing server.js/app.js
my app file is a vue file, but i don´t really know how to fix this, it´s also not located at the root but in a src folder
i added the web config file to the public folder
<configuration>
<system.webServer>
<!-- indicates that the index.js file is a node.js application
to be handled by the iisnode module -->
<handlers>
<add name="iisnode" path="index.js" verb="*" modules="iisnode" />
</handlers>
<!-- adds index.js to the default document list to allow
URLs that only specify the application root location,
e.g. http://mysite.antarescloud.com/ -->
<defaultDocument enabled="true">
<files>
<add value="index.js" />
</files>
</defaultDocument>
</system.webServer>
</configuration>

Related

Azure Web App Virtual Application, The resource you are looking for has been removed, had its name changed, or is temporarily unavailable

I have an Azure Web Application with Virtual Application configured under the Path mappings section. The virtual path /SP2019resources has the Physical Path as site\wwwroot\SP2019resources.
My Azure DevOps pipeline will upload the contents (SharePoint SPPKG files) to this virtual path. And I have already verified that the contents are there, however whenever I formulate a URL as https://{AzureAppName}/SP2019resources/{PackageName}.SP2019.sppkg and open it in the browser the file is not getting downloaded and always getting an error as "The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.".
Here is the file view from my web app SCM.
Any idea what I am missing here?
After spending some time with this issue, I understood what I am missing. Essentially, you will need a Web.config file in your virtual application folder to handle the requests.
The content of the file can be as follows.
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<handlers>
<clear />
<add name="StaticHandler" verb="*" path="*" type="System.Web.StaticFileHandler" />
</handlers>
<httpProtocol>
<customHeaders>
<add name="Access-Control-Allow-Origin" value="*" />
</customHeaders>
</httpProtocol>
</system.webServer>
</configuration>
After I add this file to the /SP2019resources, the files inside were getting downloaded.

IIS Throws Config File Error - 0x8007000d when trying to deploy netcore2.0 App

I'm trying to deploy a netcore2.0 MVC app to IIS and keep getting the error above.
The file permissions are set correctly and I checked that the runtime is downloaded.
The error is as follows:
Module
IIS Web Core
Notification
Unknown
Handler
Not yet determined
Error Code
0x8007000d
Config Error
Config File
\\?\E:\Dev\test-deploy\web.config
Requested URL
http://localhost:4231/
Physical Path
Logon Method
Not yet determined
Logon User
Not yet determined
Following is my Config File (generated by vs code):
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath=".\Coneckt.Web.exe" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" />
</system.webServer>
</configuration>
<!--ProjectGuid: 2833ed36-9a18-47b6-8f33-8998356796d9-->
This error occurs because the ApplicationHost.config or Web.config file contains a malformed XML element, you need to delete the malformed XML element from the ApplicationHost.config or Web.config file.
You can also refer to this link about how to deploy ASP.NET Core on IIS: Host ASP.NET Core on Windows with IIS.

.NET Core WebAPI IIS Deploying

I have created a webAPI using .Net Core and trying to publish it to IIS. But getting HTTP 500.19.
It's looking for web.config file but I don't have it.
What should I do?
Did you installed this: https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/iis/?tabs=aspnetcore2x&view=aspnetcore-3.1
If Yes check your permissions on the folder. The identity under which your web application runs in IIS may has not full access to the folder in which the web.config file is found. You could change your identity under the appPool or grant access to your folder. If you deployed into the wwwroot folder the IUser should have access to the folder.
When you publish your .net core in IIS please remember to install .net core web hosting bundle because it is not supported by default. IIS handle request based on different handlers. Even when you install the extension, aspnet core module is not registered. So please remember to set
<configuration>
<location path="." inheritInChildApplications="false">
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" requireAccess="Script" />
</handlers>
<aspNetCore processPath=".\myapp.exe" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="InProcess" />
</system.webServer>
</location>
</configuration>
If the solution doesn't fix this. Then something in your web.config is corrupting the application. Please post a screenshot the detailed error message. Then we would know how to fix this completely.

Sails.js iisnode configuration

I'm wondering if anyone could help with getting a sails JavaScript app running in IIS 7 on Windows.
https://github.com/tjanczuk/iisnode/issues/298 did not prove to be helpful for me.
I have gone through the iisnode setup and created this as my web.config file:
<configuration>
<system.webServer>
<!-- Tell IIS to use the iisnode module to run your
application -->
<handlers>
<add name="iisnode" path="app.js" verb="*" modules="iisnode" />
</handlers>
<!-- Add iisnode with the #nodeProcessCommand line if
you see the error: Make sure the node.exe executable
is available at the location specified in the
system.webServer/iisnode/#nodeProcessCommandLine element
of web.config. -->
<iisnode
nodeProcessCommandLine="%ProgramFiles%\nodejs\node.exe"
/>
<!-- Since behind the covers, Sails.js is just an express app
rewrite all urls to processed by iisnode via app.js. This
will sort out things like the routing to your public
resources (images, js, styles) and all configured rest
endpoints. -->
<rewrite>
<rules>
<rule name="root">
<match url=".*" />
<action type="Rewrite" url="app.js" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
Sails is installed and when I run the server from the terminal sails lift I can access the app at http://localhost:1337/, but when I attempt to access it through the IIS port8090 I receive a HTTP 500 with the message:
To run an app using node app.js, you usually need to have a version of sails installed in the same directory as your app.
To do that, run npm install sails
Alternatively, if you have sails installed globally (i.e. you did npm install -g sails), you can use sails lift.
When you run sails lift, your app will still use a local ./node_modules/sails dependency if it exists,
but if it doesn't, the app will run with the global sails instead!

How to install Ghost inside an existing node.js application on Azure?

Can you install Ghost (http://ghost.org) so that it runs inside an existing node.js express application (like this: {my domain}/blog)?
I'm using Azure Websites to host the site.
Please note: I would prefer a generic solution that can run on any platform... however I thought I would mention that it's on Azure in case it provides a simple way to do this.
Yes you can do that.
You will need to:
1. Add a new blog application
Basically go to portal -> CONFIGURE tab -> scroll all the way to the bottom and add something like this
2. Configure Ghost to run on a sub folder
publish Ghost to whichever folder you mapped to your application in the step above.
You can use FTP, webdeploy or SCM (https://<YouSiteName>.scm.azurewebsites.net/DebugConsole
that's what I choose and my folder layout looks like this
igonre the deployments folder, it's not related to this
in your config.js for Ghost, under the Production environment node make sure you have the url as
production: {
url: 'http://<YourSiteName>.azurewebsites.net/blog',
mail: {
......
}
}
3. Fix the main site's web.config
go to your main sites web.config and wrap the whole <system.webServer> element in a <location path="." inheritInChildApplications="false">
basically your web.config should have looked like this
<configuration>
<system.webServer>
<handlers>
<add name="iisnode" path="server.js" verb="*" modules="iisnode"/>
</handlers>
<rewrite>
<rules>
<!-- Some rewrite rules -->
</rules>
</rewrite>
....
</system.webServer>
</configuration>
and now it should look like this
<configuration>
<location path="." inheritInChildApplications="false">
<system.webServer>
<handlers>
<add name="iisnode" path="server.js" verb="*" modules="iisnode"/>
</handlers>
<rewrite>
<rules>
<!-- Some rewrite rules -->
</rules>
</rewrite>
....
</system.webServer>
</location>
</configuration>
notice this is for the main site that is the Express.js in your case not the Ghost site
that should be all you need to do.
Not sure if you can install it as an addition to your existing site, but Ghost exists as a deployable template in the Azure Web Sites gallery, under Blogs:
This is not the complete answer you were looking for, but these instructions on how to manually install Ghost on Azure Websites might help guide you in the right direction:
http://www.hanselman.com/blog/HowToInstallTheNodejsGhostBloggingSoftwareOnAzureWebsites.aspx

Resources