the contract name could not be (WCF silverlight)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • vineetbindal
    New Member
    • Jan 2009
    • 57

    the contract name could not be (WCF silverlight)

    Hi All,

    I am new to silverlight and i am following a tutorial.
    In order to connect to database in silverlight application i need to add a referance to a service. which gives me an error that the contract is not found.

    I had installed the iis after .net framework 3.5 but i have followed and done all the instructions given at microsoft's website.

    please help me.


    below is the error stack--
    Code:
    There was an error downloading 'http://localhost:50926/Service1.svc'.
    The request failed with the error message:
    --
    <html>
        <head>
            <title>The contract name 'SQLData.IService1' could not be found in the list of contracts implemented by the service 'Service1'.</title>
            <style>
             body {font-family:"Verdana";font-weight:normal;font-size: .7em;color:black;} 
             p {font-family:"Verdana";font-weight:normal;color:black;margin-top: -5px}
             b {font-family:"Verdana";font-weight:bold;color:black;margin-top: -5px}
             H1 { font-family:"Verdana";font-weight:normal;font-size:18pt;color:red }
             H2 { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon }
             pre {font-family:"Lucida Console";font-size: .9em}
             .marker {font-weight: bold; color: black;text-decoration: none;}
             .version {color: gray;}
             .error {margin-bottom: 10px;}
             .expandable { text-decoration:underline; font-weight:bold; color:navy; cursor:hand; }
            </style>
        </head>
    
        <body bgcolor="white">
    
                <span><H1>Server Error in '/' Application.<hr width=100% size=1 color=silver></H1>
    
                <h2> <i>The contract name 'SQLData.IService1' could not be found in the list of contracts implemented by the service 'Service1'.</i> </h2></span>
    
                <font face="Arial, Helvetica, Geneva, SunSans-Regular, sans-serif ">
    
                <b> Description: </b>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.
    
                <br><br>
    
                <b> Exception Details: </b>System.InvalidOperationException: The contract name 'SQLData.IService1' could not be found in the list of contracts implemented by the service 'Service1'.<br><br>
    
                <b>Source Error:</b> <br><br>
    
                <table width=100% bgcolor="#ffffcc">
                   <tr>
                      <td>
                          <code>
    
    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.</code>
    
                      </td>
                   </tr>
                </table>
    
                <br>
    
                <b>Stack Trace:</b> <br><br>
    
                <table width=100% bgcolor="#ffffcc">
                   <tr>
                      <td>
                          <code><pre>
    
    [InvalidOperationException: The contract name 'SQLData.IService1' could not be found in the list of contracts implemented by the service 'Service1'.]
       System.ServiceModel.Description.ConfigLoader.LookupContract(String contractName, String serviceName) +11606655
       System.ServiceModel.Description.ConfigLoader.LoadServiceDescription(ServiceHostBase host, ServiceDescription description, ServiceElement serviceElement, Action`1 addBaseAddress) +11605707
       System.ServiceModel.ServiceHostBase.LoadConfigurationSectionInternal(ConfigLoader configLoader, ServiceDescription description, ServiceElement serviceSection) +55
       System.ServiceModel.ServiceHostBase.LoadConfigurationSectionInternal(ConfigLoader configLoader, ServiceDescription description, String configurationName) +35
       System.ServiceModel.ServiceHostBase.ApplyConfiguration() +69
       System.ServiceModel.ServiceHostBase.InitializeDescription(UriSchemeKeyedCollection baseAddresses) +190
       System.ServiceModel.ServiceHost.InitializeDescription(Type serviceType, UriSchemeKeyedCollection baseAddresses) +32
       System.ServiceModel.ServiceHost..ctor(Type serviceType, Uri[] baseAddresses) +139
       System.ServiceModel.Activation.ServiceHostFactory.CreateServiceHost(Type serviceType, Uri[] baseAddresses) +28
       System.ServiceModel.Activation.ServiceHostFactory.CreateServiceHost(String constructorString, Uri[] baseAddresses) +331
       System.ServiceModel.HostingManager.CreateService(String normalizedVirtualPath) +11656060
       System.ServiceModel.HostingManager.ActivateService(String normalizedVirtualPath) +42
       System.ServiceModel.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath) +479
    
    [ServiceActivationException: The service '/Service1.svc' cannot be activated due to an exception during compilation.  The exception message is: The contract name 'SQLData.IService1' could not be found in the list of contracts implemented by the service 'Service1'..]
       System.ServiceModel.AsyncResult.End(IAsyncResult result) +11527194
       System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result) +194
       System.ServiceModel.Activation.HostedHttpRequestAsyncResult.ExecuteSynchronous(HttpApplication context, Boolean flowContext) +176
       System.ServiceModel.Activation.HttpHandler.ProcessRequest(HttpContext context) +23
       System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +181
       System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75
    </pre></code>
    
                      </td>
                   </tr>
                </table>
    
                <br>
    
                <hr width=100% size=1 color=silver>
    
                <b>Version Information:</b>*Microsoft .NET Framework Version:2.0.50727.3053; ASP.NET Version:2.0.50727.3053
    
                </font>
    
        </body>
    </html>
    <!-- 
    [InvalidOperationException]: The contract name 'SQLData.IService1' could not be found in the list of contracts implemented by the service 'Service1'.
       at System.ServiceModel.Description.ConfigLoader.LookupContract(String contractName, String serviceName)
       at System.ServiceModel.Description.ConfigLoader.LoadServiceDescription(ServiceHostBase host, ServiceDescription description, ServiceElement serviceElement, Action`1 addBaseAddress)
       at System.ServiceModel.ServiceHostBase.LoadConfigurationSectionInternal(ConfigLoader configLoader, ServiceDescription description, ServiceElement serviceSection)
       at System.ServiceModel.ServiceHostBase.LoadConfigurationSectionInternal(ConfigLoader configLoader, ServiceDescription description, String configurationName)
       at System.ServiceModel.ServiceHostBase.ApplyConfiguration()
       at System.ServiceModel.ServiceHostBase.InitializeDescription(UriSchemeKeyedCollection baseAddresses)
       at System.ServiceModel.ServiceHost.InitializeDescription(Type serviceType, UriSchemeKeyedCollection baseAddresses)
       at System.ServiceModel.ServiceHost..ctor(Type serviceType, Uri[] baseAddresses)
       at System.ServiceModel.Activation.ServiceHostFactory.CreateServiceHost(Type serviceType, Uri[] baseAddresses)
       at System.ServiceModel.Activation.ServiceHostFactory.CreateServiceHost(String constructorString, Uri[] baseAddresses)
       at System.ServiceModel.ServiceHostingEnvironment.HostingManager.CreateService(String normalizedVirtualPath)
       at System.ServiceModel.ServiceHostingEnvironment.HostingManager.ActivateService(String normalizedVirtualPath)
       at System.ServiceModel.ServiceHostingEnvironment.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath)
    [ServiceActivationException]: The service '/Service1.svc' cannot be activated due to an exception during compilation.  The exception message is: The contract name 'SQLData.IService1' could not be found in the list of contracts implemented by the service 'Service1'..
       at System.ServiceModel.AsyncResult.End[TAsyncResult](IAsyncResult result)
       at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result)
       at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.ExecuteSynchronous(HttpApplication context, Boolean flowContext)
       at System.ServiceModel.Activation.HttpHandler.ProcessRequest(HttpContext context)
       at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
       at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
    -->
    --.
    Metadata contains a reference that cannot be resolved: 'http://localhost:50926/Service1.svc'.
    The server did not provide a meaningful reply; this might be caused by a contract mismatch, a premature session shutdown or an internal server error.
    If the service is defined in the current solution, try building the solution and adding the service reference again.
    Last edited by tlhintoq; Mar 24 '09, 11:03 PM. Reason: Added [CODE] tags to the error to make it easier to read the nesting.
  • Plater
    Recognized Expert Expert
    • Apr 2007
    • 7872

    #2
    Somewhere you are trying to use 'SQLData.IServi ce1' and it doesn't exist. Either create it, or rename it to a service you do have?
    According to the error message, its trying to run as .NET2.0, you might need to change it to use 3.5?

    Comment

    Working...