I published a json file on to my website using ftp. When I tried to access my site using mtsite.com/abc.json it throws the below error.
The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.
My file is on hosted site on azure. Even if file in on server why did it say that file is not found?
Any place in azure portal where I can add or allow Mime type json? I cannot add web.config file as My files are all HTML and Json.
By default IIS (and so the Azure App Service) doesn't serve .json files. You need to enable this feature in your web.config. If don't already have one, create it in the root directory.
Open your web.config and place this code
<staticContent>
<remove fileExtension=".json"/>
<mimeMap fileExtension=".json" mimeType="application/json"/>
</staticContent>
under the nodes
<configuration>
<system.webServer>
And it should be fixed.
Here you can find a basic web.config template that i've made a while ago
P.S: Even though you are using only HTML and JSON, this is the only way to go (as there is not a UI solution in the portal). In this way you could also control other aspect of your website, for example the redirect to HTTPS for the HTTP requests.
Related
I just published an Angular app to Azure Web Apps, after confirming general operation locally. However, I now get the following error (HTTP Error 404.0 - Not Found), specifically the D:\home\site\wwwroot\bin\www file:
However, using the Kudu tools, I can see that the file is indeed there:
What could cause this error?
By default, IIS blocks serving content from certain folders, including bin. You can either a) move the www folder out of the bin directory, or b) you could add the following configuration to the web.config:
<configuration>
<system.webServer>
<security>
<requestFiltering>
<hiddenSegments>
<remove segment="bin" />
</hiddenSegments>
</requestFiltering>
</security>
</system.webServer>
</configuration>
The 404.0 Error on bin\www was a bit of a misdirection. After putting a console.log in the www file and watching output, I found out that indeed bin\www was being called properly. The problem was further in and related to the serving of static content, initially the index.html file.
I was previously using the following to serve up index.html:
var serveStatic = require('serve-static');
...
app.use(serveStatic('.', { 'index': ['index.html'] }));
For some reason, while this worked locally, this didn't work once published to Azure Web App. So I decided to use a method that had worked for others. First I moved index.html to /public, and then used express.static:
app.use(express.static(__dirname + '/public'));
It should also be noted, that the associated web.config file must also have information related to the static content, for example: How to enable static files (and less support) when hosting a nodejs app within IIS using IISNode
I've created a solution that contains a Web API 2 project as well as a separate HTML project to house my AngularJS SPA. The latter project contains index.html with app and Scripts folders. When I debug locally, I receive HTTP 403.14 Forbidden. Are there additional configuration steps needed to ensure the app will run locally as well as when deployed to Azure?
Try browsing directly to the index.html and not only to document root.
If that works, add those line to your web.config to set default document.
<system.webServer>
<defaultDocument enabled="true">
<files>
<clear/>
<add value="index.html"/>
</files>
</defaultDocument>
</system.webServer>
I am working on AngularJs application with node.js. Using gulp, I have created (compiled) my application (app in below image) and got the following directories
Now I completely struck how to proceed next. I want to host this application over IIS to run and see the pages (in views folder) but I don't know how to host it on IIS.
I tried this article, but it guides to use express server.
The issue is, how IIS will figure out that the first page lies in views folder, and even if I use the complete url
http://localhost:8078/views/index.html
it shows me all angular code with brackets like {{logginuser}} etc
EDIT:
Do I need web.config file here or not. If yes then how I will define entry point to the application?
Just have to configure a Web Application under a website in IIS and create a custom web.config.
In IIS, go to the Default Web Site, right-click and select Add Web Application
Set the Alias to be AngularApp and the Physical Path to be the root of your directory
Add a web.config file at the root of the directory with the following code
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<defaultDocument>
<files>
<add value="views/index.html" />
</files>
</defaultDocument>
</system.webServer>
</configuration>
Browse to your new Angular application by going to http://localhost/AngularApp (assuming http binding in IIS).
Lost 2 hours with this
The solution was to go to WINDOWS FEATURES and check 'static content', under COMMON HTTP features.
Hope this helps someone.
You need set as start page to you main screen (like index.html)
How can I set it in IIS?
Just go to web.config file and add following
<system.webServer>
<defaultDocument>
<files>
<clear />
<add value="index.html" />//Path of your Page
</files>
</defaultDocument>
</system.webServer>
More details : How do I set the default page of my application in IIS7?
I've found this to be a very useful tutorial so far, probably one of the best step by step guides ever created for programming as EVERY SINGLE STEP is seen committed via GitHub:
http://docs.angularjs.org/tutorial/the_end
I hit a brick wall towards the middle and I can't host a json object on a Microsoft IIS server I have provided by GoDaddy. I have to edit my web.config file because Microsoft apparently thought it was a great idea to throw a 404 on the URL of a pure JSON object:
http://cinicraft.com/angular/phones/phones.json
So that's a valid URL according to my FTP browser, but yeah I get a 404. Microsoft is brilliant in using the "not found" error exception with a file that exists.
And so I can't really go any further with the tutorial, I've decided to try running the completed version Google has available on GitHub, but I have no idea on how to run this:
۩/partials/
۞/phone-list.html
۞/phone-detail.html
۩/js/
۞/jquery.js
۞/controllers.js
۞/app.js
۞/angular.min.js
۞/bootstrap.min.js
۩/angular
۞/angular-route.js
۩/test
۩/phones
۩/fonts
/index.html
If I just open index.html straight from my finder on Chrome I only see a blank page, how does one run this AngularJS app?
Is node.js required?
Please look at the url https://github.com/angular/angular-phonecat and Prerequisites
Go to applicationhost.config file in your IIS config folder and add the following where similar mime types are defined
<mimeMap fileExtension=".json" mimeType="application/json" />
If still not allowed go to <requestFiltering> section and add the following
<add fileExtension=".json" allowed="true" />
We've got a SharePoint site with a custom application that is designed for both web and mobile that we are trying to upgrade from SP2007 to SP2010. The site contains playlists of mp4 files. We have asp.net session state active on the site for use within the custom application. We also rewrite urls to HTTPS.
The files are stored on disk and accessed through a virtual directory.
When the files are accessed through the SP2010 web site (non-mobile), the mp4 file plays just fine.
When the exact same url is accessed from a mobile browser, we receive the message:
Session state can only be used when enableSessionState is set to true, either in a
configuration file or in the Page directive. Please also make sure that
System.Web.SessionStateModule or a custom session state module is included in the
<configuration>\<system.web>\<httpModules> section in the application configuration.
We DO have the SessionStateModule declared in <configuration>\<system.webServer>\<modules> as follows:
<add name="Session" type="System.Web.SessionState.SessionStateModule" preCondition="" />
We have also tried without the preCondition, and with preCondition="integratedMode".
An example of the url is https://example.com/Assets/Job63/8f9e85d5-d7f3-4536-a9b1-69537b7da9bf/Previews/0568145f-b314-4354-a081-d72019a42d11.mp4 (the domain has been changed to protect the innocent).
The virtual directory is /Assets and it points to a c:\Assets directory.
This behavior occurs even using FireFox and changing the user agent to simulate mobile, so it appears to be something intercepting mobile requests.
None of the other sessionstate answers on the site appear to cover this problem.
We also have the SessionStateModule declared in the IIS Module list for the website.
What may be causing this problem?
We were able to resolve the issue by putting a web.config file containing the following into the assets folder. It is apparently the aggressive mobile redirect that SharePoint does in SP2010 that causes the problem, as explained at the following url - http://blog.mastykarz.nl/inconvenient-sharepoint-2010-mobile-redirect/ .
web.config contents:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.web>
<browserCaps>
<result type="System.Web.Mobile.MobileCapabilities, System.Web.Mobile, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<filter>isMobileDevice=false</filter>
</browserCaps>
</system.web>
</configuration>