I am currently utilizing Visual Studio 2013 along with IIS Express.
Within my HTML page, there is a JavaScript (EXTJS) code that is making a request to a file.json using the HTTP POST method. However, I am consistently receiving an error message saying "HTTP Error 405.0 - Method Not Allowed"
To troubleshoot, I have made the following additions to the web.config file
<system.webServer>
<staticContent>
<mimeMap fileExtension=".json" mimeType="application/json" />
</staticContent>
</system.webServer>
I have also executed the following command in the command prompt
appcmd set config /section:staticContent /+[fileExtension='JSON',mimeType='application/x-javascript']
Despite these efforts, the issue persists.
I can successfully access the .json file using a GET request, such as http://localhost/file.json
, but encounters the error with a POST request.
Below is the ExtJS code responsible for calling the JSON file
Ext.onReady(function () {
var tree = new Ext.tree.TreePanel({
renderTo: 'tree-div',
title: 'My Task List',
height: 300,
width: 400,
useArrows: true,
autoScroll: true,
animate: true,
enableDD: true,
containerScroll: true,
rootVisible: false,
frame: true,
root: {
nodeType: 'async'
},
dataUrl: 'file.json'
});
tree.getRootNode().expand(true);
});
The file.json contains JSON data structured as follows
[{
text: 'To Do',
cls: 'folder',
children: [{
text: 'Go jogging',
leaf: true,
checked: false
},{
text: 'Take a nap',
leaf: true,
checked: false
},{
text: 'Climb Everest',
leaf: true,
checked: false
}]
},.....