I am trying to access a webservice but have problems with connecting.
Config file is after the error.
This is the code i am using and the error is as below:
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml;
using Breakingviews.www.BreakingViewsWebService;
using Breakingviews.Configuration;
using System.Web.Services.Protocols;
using System.Net;
public partial class MostRead : System.Web.UI.Page
{
private ContentInfoService BuildContentInfoService()
{
ContentInfoService contentInfoService = new
ContentInfoService();
AddxxxxxxxCookies(contentInfoService);
return contentInfoService;
}
static void AddMagicCookies(SoapHttpClientProtocol webService)
{
CookieContainer cookieContainer = new CookieContainer();
string secret =
BvConfiguration.GetConfigurationString("SomeString");
Uri uri = new Uri(webService.Url);
cookieContainer.Add(new Cookie("xxxxxxx", secret, "/",
uri.Host));
webService.CookieContainer = cookieContainer;
}
public void ListReadyStories()
{
ContentInfoService service = BuildContentInfoService();
Guid[] stories = service.ListReadyStories(60);
//List<Guid> storyList = new List<Guid>(stories);
Response.Write(stories.ToString());
}
protected void Page_Load(object sender, EventArgs e)
{
ListReadyStories();
}
}
************************************************************************
*******************
Error page i get when i view MostRead.aspx in Browser
************************************************************************
*******************
Server Error in '/' Application.
------------------------------------------------------------------------
--------
Couldn't find type for class
Breakingviews.WebModules.AssertHealth.AssertListener,
Breakingviews.WebModules.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.
Exception Details: System.Configuration.ConfigurationErrorsException:
Couldn't find type for class
Breakingviews.WebModules.AssertHealth.AssertListener,
Breakingviews.WebModules.
Source Error:
Line 29: {
Line 30: string settingValue =
ConfigurationSettings.AppSettings[key];
Line 31: Debug.WriteLine("Read configuration value " + key +
"=" + settingValue);
Line 32: return settingValue;
Line 33: }
Source File:
C:\BackUp\code\dotnet\Breakingviews.Configuration\BvConfiguration.cs
Line: 31
Stack Trace:
[ConfigurationErrorsException: Couldn't find type for class
Breakingviews.WebModules.AssertHealth.AssertListener,
Breakingviews.WebModules.]
System.Diagnostics.TraceUtils.GetRuntimeObject(String className, Type
baseType, String initializeData) +1902756
System.Diagnostics.TypedElement.BaseGetRuntimeObject() +42
System.Diagnostics.ListenerElement.GetRuntimeObject() +82
System.Diagnostics.ListenerElementsCollection.GetRuntimeObject() +134
System.Diagnostics.TraceInternal.get_Listeners() +134
System.Diagnostics.TraceInternal.WriteLine(String message) +105
System.Diagnostics.Debug.WriteLine(String message) +4
Breakingviews.Configuration.BvConfiguration.GetConfigurationString(Strin
g key) in
C:\BackUp\code\dotnet\Breakingviews.Configuration\BvConfiguration.cs:31
Breakingviews.Configuration.BvConfiguration.GetConfigurationTimeSpan(Str
ing key, TimeSpan defaultValue) in
C:\BackUp\code\dotnet\Breakingviews.Configuration\BvConfiguration.cs:47
Breakingviews.WebModules.ConcurrentUsageModule..cctor() in
C:\BackUp\code\dotnet\Breakingviews.WebModules\ConcurrentUsageModule.cs:
28
[TypeInitializationException: The type initializer for
'Breakingviews.WebModules.ConcurrentUsageModule' threw an exception.]
[TargetInvocationException: Exception has been thrown by the target of
an invocation.]
System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean
publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandle&
ctor, Boolean& bNeedSecurityCheck) +0
System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean
fillCache) +103
System.RuntimeType.CreateInstanceImpl(Boolean publicOnly, Boolean
skipVisibilityChecks, Boolean fillCache) +268
System.Activator.CreateInstance(Type type, Boolean nonPublic) +66
System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr,
Binder binder, Object[] args, CultureInfo culture, Object[]
activationAttributes) +1036
System.Activator.CreateInstance(Type type, BindingFlags bindingAttr,
Binder binder, Object[] args, CultureInfo culture, Object[]
activationAttributes) +114
System.Web.Configuration.Common.ModulesEntry.Create() +41
System.Web.Configuration.HttpModulesSection.CreateModules() +203
System.Web.HttpApplication.InitInternal(HttpContext context,
HttpApplicationState state, MethodInfo[] handlers) +1006
System.Web.HttpApplicationFactory.GetNormalApplicationInstance(HttpConte
xt context) +259
System.Web.HttpApplicationFactory.GetApplicationInstance(HttpContext
context) +114
System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr)
+350
------------------------------------------------------------------------
--------
Version Information: Microsoft .NET Framework Version:2.0.50727.1433;
ASP.NET Version:2.0.50727.1433
Webconfig file under <appsettings>: Values have been changed for
confidentiality:
<add key="Secretsomeotherkey"
value="{643E7B39-991F-487c-AA52-B408071BGFDE9}!~secret~!{5B68008E-5054-4
oc7-B7E2-1C82E0BF5965}"/>
<!-- the password that is passed (as a cookie) to access the
webservice
This isn't particularly secure (it's passed as plaintext)
but the webservice itself
is designed for this to be broken -->
<add key="SomeString"
value="{0BD4523-3A2D-4880-81H4-278GG20FC6A4}"/>
<!-- The list of IP addresses that the internal web services will
listen to, separated by semi-colons (;) -->
<add key="SomeStringforSafeAddresses"
value="127.0.0.1;222.33.30.122;222.131.113.222;192.1.1.6;192.1.1.233;192
.1.1.254"/>
John Saunders [MVP] - 16 Mar 2008 23:02 GMT
>I am trying to access a webservice but have problems with connecting.
> Config file is after the error.
It happens that the problem has nothing to do with your code. The problem is
in the config file. Your code triggers detection of the problem as soon as
you reference the config file.
The problem is clearly stated:
Couldn't find type for class
Breakingviews.WebModules.AssertHealth.AssertListener,
Breakingviews.WebModules.
Look in your config file to find a reference to this class. Figure out what
the class is supposed to be, where it's supposed to be, then figure out why
it isn't where it's supposed to be.

Signature
--------------------------------------------------------------------------------
John Saunders | MVP - Windows Server System - Connected System Developer