Click to See Complete Forum and Search --> : xml tags unrecognised by server??


lily82
03-12-2005, 01:55 AM
I am new to xml and I am trying to use xml as web.config file. I will use asp.net form to get the web.config settings. Below is my web.config file:

<?xml version="1.0" encoding="UTF-8" ?>

<configuration>

<system.web>

<appSettings>
<add key="Searcharoo_VirtualRoot" value="http://localhost/" /> <!--website to spider-->
<add key="Searcharoo_RequestTimeout" value="5" /> <!--5 second timeout when downloading-->
<add key="Searcharoo_RecursionLimit" value="200" /> <!--Max pages to index-->
</appSettings>

</system.web>

</configuration>

every time I try to run the asp.net web form, error msg will appear said that Unrecognized configuration section 'appSettings'. I had do references on MSDN library and I follow the steps but still get the same error. I wonder is there anything to do with the asp.net web form which will get settings from this web.config file? The part of the file to get settings is as below:

// get web.config settings
if (null != configurationSettings.appSettings["Searcharoo_RequestTimeout"]) {
prefRequestTimeout = Convert.ToInt32(configurationSettings.appSettings["Searcharoo_RequestTimeout"]);
}
if (null != configurationSettings.appSettings["Searcharoo_VirtualRoot"]) {
startingUri = new Uri (configurationSettings.appSettings["Searcharoo_VirtualRoot"].ToString() );
} else {
//startingUri = new Uri ("http://localhost:8080/"); // occasionally hardcode this for testing...
startingUri = new Uri ("http://" + Request.ServerVariables["HTTP_HOST"]);
}

I really stuck now and hope that sm 1 will help me out this problem..Thank you so much.

Khalid Ali
03-13-2005, 09:02 AM
I don't know anything about .NET stuff, however it obviously looks like that the tag you are trying to refer to is not recognised.
The only thing that can cause such behaviour is that either file is not being read by the server at all or the configuration file's xml structure does not conform to the one that is required for such files.

lily82
03-14-2005, 12:26 AM
thank for helpin me but after I do sm search again on xml tags, I found that the problem was from the file callin the web.config.