# .NET and More > WPF, WCF, WF >  [RESOLVED] do not have access to operationcontract method

## arkiboys

In my wcf project, I can see several operationcontracts
I do not see the new one I have just added i.e.

inside the interface class:

...
...
...

[OperationContract]
void WriteAllSQL(string strXML);

in the .svc.cs file

...
...
...
public void WriteAllSQL(string strXML)
{
...
...
}

On the client, when I create an instance to the wcf, I only see the previous operationcontracts and not the new ones.

Have i not done something correctly?

----------


## gep13

Hey,

Try updating the Service Reference within your client project.

Gary

----------


## arkiboys

This is what is surprizing. I have updated the references many times. but in th esolution, the silverlight app does not see the new method in wcf.
BUT, using the wcf test client tool, it does see it.

----------


## gep13

In which case, try removing the service reference, and re-add it.

Gary

----------


## arkiboys

still the same problem.

----------


## gep13

Were there any warnings, or errors while the Service Reference was being created?

Certains DataTypes are not supported in Silverlight, and I have seen the methods that use them not appear in the Service Reference.

Gary

----------


## arkiboys

No warning.
And even if I add any new methods, they will not be shown.

----------


## gep13

Ok, so to clarify...

You have a WCF Endpoint that exposed some methods.  You created the Service Reference initially, and could see the methods.  Now, you have added some new methods, but even though you update the service reference, you can't see these new methods.  However, if you use the WCF Test Client, you can see all the methods.

Does that pretty much sum up where you are?

Gary

----------


## arkiboys

That is correct.
As an extra test, I added a new .svc and added two public methods. and then republished the wcf into the virtual directory, etc...
The wcf test client.exe can see the new methods inside the new .svc whereas the methods can not be seen inside the silverlight app project aftering doing the usual add service reference, etc.

----------


## gep13

Can you show the definition of one of the methods that isn't working?  What are the DataTypes that you are using?

----------


## arkiboys

public void WriteToXML(string strXML)
        {
            try
            {
                Utilities.logfile("Begin WriteXML");
            }
            catch (Exception ex)
            {
                Utilities.logfile("error : ");
            }
        }

----------


## arkiboys

Only th eold methods are shown.
Somehow the new methods are blocked fom being shown.
Could this be to do with security/permission settings that may have been changed ? (Nothing that I know of has been changed).

----------


## gep13

Hey,

I am really not sure what else to suggest at this point.

Is it possible that you can upload your project somewhere so that I can take a look?

Gary

----------


## arkiboys

Do you think th eproblem is the silverlight application project not being able to see the wcf properly?
It seems the wcf side is ok, since the wcf test client.exe does indeed see all the methods in wcf.

----------


## gep13

This is what I am not sure of.

It certainly looks like it is the Silverlight side of things that is causing the problem, but I am really not sure what could be wrong.

Gary

----------


## arkiboys

I now created a brand new solution with silverlight project. added servicesreferences to point to the existing wcf. Still does not see the new methods and it even doe snot see any methods within any new .svc files.

----------


## arkiboys

gary,
Could this be to do with port number on my machine?
<endpoint address="http://localhost:1841/DM.svc"
        binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IDM"
        contract="FMService.IDM" name="BasicHttpBinding_IDM" />

----------


## gep13

Hey,

I don't see how that could be making some things come through, but then stopping others.

Gary

----------


## arkiboys

I even did clean and then build.
No difference.

----------


## arkiboys

> Hey,
> 
> I don't see how that could be making some things come through, but then stopping others.
> 
> Gary


Have been doing extra checks...
It seems th eproblem is definitely to do with the silverlight application project wher eit does not see the new methods inside the wcf project.
Created a new solution with new silverlight application project as well as new wcf project.
the silverlight pages do see the new .svc files and their methods...
Still not sure what the problem is in that silverlight app.

----------


## arkiboys

Gary,
Still looking at this issue, and so trie again by adding a new .svc to the wcf project. Then in silverlight project, in addingservices... ths following error is shown when usingthe new service. can you see if there is something that can show what the problem is please?

There was an error downloading 'http://localhost:1841/AnotherService.svc'.
The request failed with the error message:
--
<html>
    <head>
        <title>The type 'FServices.AnotherService', provided as the Service attribute value in the ServiceHost directive, or provided in the configuration element system.serviceModel/serviceHostingEnvironment/serviceActivations could not be found.</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 type 'FServices.AnotherService', provided as the Service attribute value in the ServiceHost directive, or provided in the configuration element system.serviceModel/serviceHostingEnvironment/serviceActivations could not be found.</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 type 'FServices.AnotherService', provided as the Service attribute value in the ServiceHost directive, or provided in the configuration element system.serviceModel/serviceHostingEnvironment/serviceActivations could not be found.<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 type 'FServices.AnotherService', provided as the Service attribute value in the ServiceHost directive, or provided in the configuration element system.serviceModel/serviceHostingEnvironment/serviceActivations could not be found.]
   System.ServiceModel.Activation.ServiceHostFactory.CreateServiceHost(String constructorString, Uri[] baseAddresses) +51902
   System.ServiceModel.HostingManager.CreateService(String normalizedVirtualPath) +1440
   System.ServiceModel.HostingManager.ActivateService(String normalizedVirtualPath) +44
   System.ServiceModel.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath) +615

[ServiceActivationException: The service '/AnotherService.svc' cannot be activated due to an exception during compilation.  The exception message is: The type 'FServices.AnotherService', provided as the Service attribute value in the ServiceHost directive, or provided in the configuration element system.serviceModel/serviceHostingEnvironment/serviceActivations could not be found..]
   System.Runtime.AsyncResult.End(IAsyncResult result) +679246
   System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result) +190
   System.ServiceModel.Activation.HostedHttpRequestAsyncResult.ExecuteSynchronous(HttpApplication context, String routeServiceVirtualPath, Boolean flowContext, Boolean ensureWFService) +234
   System.ServiceModel.Activation.HttpModule.ProcessRequest(Object sender, EventArgs e) +355
   System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +148
   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:4.0.30319; ASP.NET Version:4.0.30319.1

            </font>

    </body>
</html>
<!-- 
[InvalidOperationException]: The type 'FServices.AnotherService', provided as the Service attribute value in the ServiceHost directive, or provided in the configuration element system.serviceModel/serviceHostingEnvironment/serviceActivations could not be found.
   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 '/AnotherService.svc' cannot be activated due to an exception during compilation.  The exception message is: The type 'FServices.AnotherService', provided as the Service attribute value in the ServiceHost directive, or provided in the configuration element system.serviceModel/serviceHostingEnvironment/serviceActivations could not be found..
   at System.Runtime.AsyncResult.End[TAsyncResult](IAsyncResult result)
   at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result)
   at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.ExecuteSynchronous(HttpApplication context, String routeServiceVirtualPath, Boolean flowContext, Boolean ensureWFService)
   at System.ServiceModel.Activation.HttpModule.ProcessRequest(Object sender, EventArgs e)
   at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute(  )
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
-->
--.
Metadata contains a reference that cannot be resolved: 'http://localhost:1841/AnotherService.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.

----------


## arkiboys

Gary,
Could this be to do with namespaces?
Everytime I add a new .svc file the namespace becomes FService but I have changed the namespaces for all the files. ?

----------


## gep13

Hey,

I don't think you should need to alter the namespaces at all, this is not something that I have ever had to the do.  The proxy class that gets created for the service reference is based on the name that you first give it when you add the service reference.

Is it possible that you can upload your sample project so that I can take a look, along with steps to reproduce the problem that you are having?

Gary

----------


## arkiboys

The problem was solved by creating a new wcf project.
Thank you for your time Gary

----------


## gep13

Hey,

Glad to hear that you got it sorted out.  Still don't have an explanation as to what happened though  :Frown: 

Gary

----------


## arkiboys

Me neither.
Hope I do not have to go through that again.
Thanks again.

----------

