tags:

views:

19

answers:

1

I have searched online for a solution, but have yet to find one that works.

I have a Silverlight application that uses a WCF web service.

Everything runs fine on my development environment.

When I publish to my DiscountASP.NET account - the web service gives me the following exception:

"Server Error in '/eLearning/Services' Application. The type 'eLearning.Web.Services.Learning, eLearning.Web', provided as the Service attribute value in the ServiceHost directive could not be found. "

Please refer to the actual exception at:

http://www.christophernotley.com/eLearning/Services/Learning.svc

I have made "eLearning" a web application - and moved the web.config to the root directory.

I have also confirmed that in the markup for the web service, that the service property states "eLearning.Web.Services.Learning, eLearning.Web".

Any ideas as to what I am doing wrong?

Thanks.

Chris

Here is the markup for the web service:

<%@ ServiceHost Language="C#" Debug="true" Factory="System.Data.Services.DataServiceHostFactory, System.Data.Services, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" Service="eLearning.Web.Services.Learning, eLearning.Web" CodeBehind="Learning.svc.cs" %>

Here is the System.ServiceModel web config:

<system.serviceModel>
    <behaviors>
        <endpointBehaviors>
            <behavior name="RestBehaviorConfig">
                <webHttp/>
            </behavior>
            <behavior name="webBehavior">
                <webHttp/>
            </behavior>
        </endpointBehaviors>
        <serviceBehaviors>
            <behavior name="DebugEnabled">
      <serviceMetadata httpGetEnabled="true"/>
                <serviceDebug includeExceptionDetailInFaults="true"/>
            </behavior>
        </serviceBehaviors>
    </behaviors>
    <bindings>
        <customBinding>
            <binding name="customBinding0">
                <binaryMessageEncoding/>
                <httpTransport/>
            </binding>
        </customBinding>
    </bindings>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true">
        <baseAddressPrefixFilters>
    <add prefix="http://www.christophernotley.com/"/&gt;
        </baseAddressPrefixFilters>
    </serviceHostingEnvironment>
    <services>
  <service behaviorConfiguration="DebugEnabled" name="eLearning.Web.Services.Learning">
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
  </service>
    </services>

</system.serviceModel>
+2  A: 

Well, in a WCF scenario, your service URL is determined by three things:

  • the name of the server
  • the virtual directory (and any subdirectories) where the svc-file lives
  • the name and extension of the svc file itself

In your case, the URL is

http://www.christophernotley.com/eLearning/Services/Learning.svc

So this begs the question:

  • is /eLearning really defined as a virtual directory?
  • is there a /Services subdirectory below your virtual directory?
  • is the name of the *.svc file correct?
  • where is the actual service code located? Do you have an assembly with the service implementation, and is it located in a place that is accessible to the *.svc file? (it's directory, a .\bin subdirectory)? Or is the code in a App_Code directory? Where is this directory??

UPDATE:

I'm a bit confused about your setup..... you say /eLearning/Services is an application - a virtual application defined in IIS, right?

In your Learning.svc file, you define a code-behind file of Learning.svc.cs - so does your service code exist there? (because in another statement, you mention a .\bin directory under /eLearning - is your service compiled into an assembly that's deployed to that bin directory??)

marc_s
I have posted the web service markup and the web.config, in case this helps.I defined /eLearning as an application in DiscountASP.NET's control panel. I also defined /eLearning/Services as an application.The name of the *.svc file is Learning.svc.The actual service code is located in the \bin directory, which is located in \eLearning.
Chris
Based on the error message (missing type), I would guess that it's your last point - missing assembly i.e. `bin` directory.
Aaronaught
But any assemblies within the .NET framework don't have to be included in the /bin directory, right? For example, in my service markup I am using "System.Data.Services.DataServiceHostFactory" for the service factory. Does that mean that System.Data.Services.dll has to be included in the /bin directory?
Chris
FYI - there is no App_Code directory in my solution.
Chris
@Chris: your virtual application is /eLearning/Services, but the bin directory is under /eLearning?? Try moving it under /eLearning/Services - that's where the *.svc file lives, it should be under there
marc_s
I'm stumped though - in the SVC file, you define a code-behind file..... is your service code in the *.svc.cs file you specify, or assembled into a DLL ???
marc_s
One step closer - I moved the /bin directory to the /services directory and now get a different exception:IIS specified authentication schemes 'Basic, Anonymous', but the binding only supports specification of exactly one authentication scheme. Valid authentication schemes are Digest, Negotiate, NTLM, Basic, or Anonymous. Change the IIS settings so that only a single authentication scheme is used.
Chris
@Chris: That is a very different error which is related to the web site configuration in IIS. It's also a relatively specific error that directs you to where you need to look. I've given Marc a +1 because I think he's answered your question correctly and I think you should accept the answer as well.
Aaronaught