Sep 18, 2012, 7:53 AM
[CLOSED] Ajax proxy working only in development server
Hi,
I am using a treepanel with a ajax proxy.
It works when I run it in Visual Studio but when I deploy it to IIS I get the following error on databinding:
"Request format is unrecognized for URL unexpectedly ending in '/GetNodes'. "
Here is my code, taken from ext.net example "https://examples2.ext.net/#/TreePanel/Loaders/WebService/" :
.aspx
web service
I am using a treepanel with a ajax proxy.
It works when I run it in Visual Studio but when I deploy it to IIS I get the following error on databinding:
"Request format is unrecognized for URL unexpectedly ending in '/GetNodes'. "
Here is my code, taken from ext.net example "https://examples2.ext.net/#/TreePanel/Loaders/WebService/" :
.aspx
<script type="text/javascript">
function getXmlResponseData(response) {
alert(response);
try {
var xmlData = response.responseXML,
root = xmlData.documentElement || xmlData;
return this.readRecords(Ext.decode(root.firstChild.nodeValue));
} catch (ex) {
var error = new Ext.data.ResultSet({
total: 0,
count: 0,
records: [],
success: false,
message: ex.message
});
this.fireEvent('exception', this, response, error);
return error;
}
}
</script>
<ext:TreePanel Width="400"
ID="tpFamiglieArticolo"
runat="server"
Title="Categorie di prodotto"
Border="true"
RootVisible="false"
>
<Store>
<ext:TreeStore ID="TreeStore1" runat="server">
<Proxy>
<ext:AjaxProxy Url="~/WebServices/TreeXmlService.asmx/GetNodes">
<ActionMethods Read="POST" />
<Reader>
<ext:JsonReader >
<CustomConfig>
<ext:ConfigItem Name="getResponseData" Value="getXmlResponseData" Mode="Raw" />
</CustomConfig>
</ext:JsonReader>
</Reader>
</ext:AjaxProxy>
</Proxy>
</ext:TreeStore>
</Store>
<Root>
<ext:Node NodeID="0" Text="Root" />
</Root>
</ext:TreePanel>
web service
/// <summary>
/// Summary description for TreeXmlService
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
[System.Web.Script.Services.ScriptService]
public class TreeXmlService : System.Web.Services.WebService
{
[WebMethod]
public string GetNodes(string node)
{
NodeCollection nodes = new NodeCollection(false);
if (!string.IsNullOrEmpty(node))
{
for (int i = 1; i < 6; i++)
{
Node asyncNode = new Node();
asyncNode.Text = node + i;
asyncNode.NodeID = node + i;
nodes.Add(asyncNode);
}
for (int i = 6; i < 11; i++)
{
Node treeNode = new Node();
treeNode.Text = node + i;
treeNode.NodeID = node + i;
treeNode.Leaf = true;
nodes.Add(treeNode);
}
}
return nodes.ToJson();
}
}
Last edited by Daniil; Sep 18, 2012 at 4:05 PM.
Reason: [CLOSED]