title: "No destination configuration registered" - WCF/SAP integration using SAP nCo3 (SAP .NET Connectior 3.0)
body: <p>When I try to call a WCF service I developed I get this error message: "Method or operation is not implemented". </p>
  
  <p>Let me explain the scenario I'm facing and them I'll give you more details, the code and etc: </p>
  
  <p>I'm developing a WCf service in .NET framework 4.0 in a Windows 8/Visual Studio 2012 machine. 
  The WCF service will be accessed from a mobile application developed in .NET compact framework 2.0 (Dev environment: a Virtual Machine running Windows XP service pack 3, Visual Studio 2008, Windows Mobile 6.1 Professional Emulator). </p>
  
  <p>The WCF service is using the SAP .NET Conector (SAPnCO) version 3.0.</p>
  
  <p>When I run the service using VS integrated IIS or IIS8, everything goes fine: I can test the service, access it from a test console application and can access it from Windows Mobile Emulator. </p>
  
  <p>However, we where about to start some preliminar tests with the final users and we still didn`t have a proper server to deploy the WCF application, so I had to make a contingency server using Windows XP and IIS express 7.5 (I was not able to make it work on IIS 5.1). </p>
  
  <p>I know that IIS Express is for local access only, but I followed this tutorial to open ti to the LAN: <a href="http://blogs.iis.net/vaidyg/archive/2010/07/29/serving-external-traffic-with-webmatrix-beta.aspx" rel="nofollow">TUTORIAL</a>.</p>
  
  <p>Doing so I can acess the service signature via browser and see the WSDL file. </p>
  
  <p>Everytime i try to acess the service I get the error message "Method or operation is not implemented". I`ve been looking for some similar problem over the internet for the past 4 hours without success. </p>
  
  <p>Here`s what I managed to do so far: </p>
  
  <ul>
  <li>Host a default WCF sample service on IIS Express 7.5 and use the service remotely: ok;</li>
  <li>Reduce the scope of the original service to the minimal only: still get the same error;</li>
  </ul>
  
  <p>So, I still don't know what can be causing this or how to solve it. I kindly request for your help, please! </p>
  
  <p>Here`s my code: </p>
  
  <p><strong>WEB.CONFIG</strong></p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;configuration&gt;
    &lt;configSections&gt;
      &lt;sectionGroup name="SAP.Middleware.Connector"&gt;
        &lt;sectionGroup name="ClientSettings"&gt;
          &lt;section name="DestinationConfiguration" type="SAP.Middleware.Connector.RfcDestinationConfiguration, sapnco"/&gt;
        &lt;/sectionGroup&gt;
      &lt;/sectionGroup&gt;
    &lt;/configSections&gt;
    &lt;SAP.Middleware.Connector&gt;
      &lt;ClientSettings&gt;
        &lt;DestinationConfiguration&gt;
          &lt;destinations&gt;
            &lt;add NAME="QA" USER="XX" PASSWD="XX" CLIENT="XX" LANG="XX" ASHOST="XX" SYSNR="XX" MAX_POOL_SIZE="XX" IDLE_TIMEOUT="XX"/&gt;
          &lt;/destinations&gt;
        &lt;/DestinationConfiguration&gt;
      &lt;/ClientSettings&gt;
    &lt;/SAP.Middleware.Connector&gt;
    &lt;startup useLegacyV2RuntimeActivationPolicy="true"&gt;
      &lt;supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/&gt;
    &lt;/startup&gt;
    &lt;appSettings/&gt;
    &lt;system.web&gt;
      &lt;compilation targetFramework="4.0" debug="true"/&gt;
      &lt;httpRuntime/&gt;
    &lt;/system.web&gt;
    &lt;system.serviceModel&gt;
      &lt;behaviors&gt;
        &lt;serviceBehaviors&gt;
          &lt;behavior&gt;
            &lt;!-- To avoid disclosing metadata information, set the values below to false before deployment --&gt;
            &lt;serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/&gt;
            &lt;!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information --&gt;
            &lt;serviceDebug includeExceptionDetailInFaults="true"/&gt;
          &lt;/behavior&gt;
        &lt;/serviceBehaviors&gt;
      &lt;/behaviors&gt;
      &lt;protocolMapping&gt;
        &lt;add binding="basicHttpsBinding" scheme="https"/&gt;
      &lt;/protocolMapping&gt;
      &lt;serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true"/&gt;
    &lt;/system.serviceModel&gt;
    &lt;system.webServer&gt;
      &lt;modules runAllManagedModulesForAllRequests="true"/&gt;
      &lt;!--
          To browse web app root directory during debugging, set the value below to true.
          Set to false before deployment to avoid disclosing web app folder information.
        --&gt;
      &lt;directoryBrowse enabled="true"/&gt;
        &lt;/system.webServer&gt;
      &lt;/configuration&gt;
  </code></pre>
  
  <p><strong>SERVICE</strong></p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Runtime.Serialization;
  using System.ServiceModel;
  using System.ServiceModel.Web;
  using System.Text;
  
  using SAP.Middleware.Connector;
  
  namespace WCFCriarOT
  {
  
      public class Service1 : IService1
      {
  
          public string CriarOT(int areaSelecionada, int nlenr, string codMaterial, int qtdMAterial)
          {
              try
              {
  
  
                  string vltyp = "", vlpla = "";
  
                  switch (areaSelecionada)
                  {
                      case 1:
                          vltyp = "902";
                          vlpla = "GR-ZONE";
                          break;
                      case 3:
                          vltyp = "901";
                          vlpla = "GFI-ZONE";
                          break;
                      case 4:
                          vltyp = "904";
                          vlpla = "DEVOLUCAO";
                          break;
                      default:
                          break;
                  }
  
                  RfcDestination SapRfcDestination = RfcDestinationManager.GetDestination("QA");
                  RfcRepository SapRfcRepository = SapRfcDestination.Repository;
                  IRfcFunction FCriarOT = SapRfcRepository.CreateFunction("ZWM001");
  
                  FCriarOT.SetValue("I_LGNUM", "WM1");
                  FCriarOT.SetValue("I_BWLVS", "999");
                  FCriarOT.SetValue("I_MATNR", codMaterial);
                  FCriarOT.SetValue("I_WERKS", "120");
                  FCriarOT.SetValue("I_LGORT", "0001");
                  FCriarOT.SetValue("I_ANFME", qtdMAterial);
                  FCriarOT.SetValue("I_SQUIT", "");
                  FCriarOT.SetValue("I_VLTYP", vltyp);
                  FCriarOT.SetValue("I_VLPLA", vlpla);
                  FCriarOT.SetValue("I_VLENR", "");
                  FCriarOT.SetValue("I_NLTYP", "");
                  FCriarOT.SetValue("I_NLPLA", "");
                  FCriarOT.SetValue("I_NLENR", nlenr.ToString().PadLeft(20, '0'));
                  FCriarOT.SetValue("I_BNAME", "PAGOTR"); // receber os dados do login posteriormente
  
                  FCriarOT.Invoke(SapRfcDestination);
  
                  if (Convert.ToInt32(FCriarOT.GetValue("E_RETURN")) == 1)
                  {
                      IRfcTable RfcReturn = FCriarOT.GetTable("T_MSG");
                      RfcReturn.CurrentIndex = 0;
  
  
  
                      return "1";
                  }
                  else
                  {
  
  
                      return "0";
                  }
              }
              catch (Exception ex)
              {
                  throw new NotImplementedException();
  
              }
          }
      } 
  </code></pre>
  
  <p><strong>SERVICE SIGNATURE</strong></p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Runtime.Serialization;
  using System.ServiceModel;
  using System.ServiceModel.Web;
  using System.Text;
  
  namespace WCFCriarOT
  {
  
      [ServiceContract]
      public interface IService1
      {
          // Contrato para a operação "Criar OT"
          [OperationContract]
          string CriarOT(int areaSelecionada, int nlenr, string codMaterial, int qtdMAterial);
  
          [OperationContract]
          string GetData(int value);
  
          [OperationContract]
          CompositeType GetDataUsingDataContract(CompositeType composite);
  
          // TODO: Add your service operations here
      }
      }
  </code></pre>
  
  <p><strong>Exception</strong></p>
  
  <pre><code>System.ServiceModel.FaultException`1 was unhandled
    HResult=-2146233087
    Message=O método ou a operação não está implementada.
    Source=mscorlib
    StackTrace:
      Server stack trace: 
         at System.ServiceModel.Channels.ServiceChannel.ThrowIfFaultUnderstood(Message reply, MessageFault fault, String action, MessageVersion version, FaultConverter faultConverter)
         at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc&amp; rpc)
         at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
         at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
         at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
      Exception rethrown at [0]: 
         at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
         at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&amp; msgData, Int32 type)
         at testeDoTeste1.ServiceReference1.IService1.CriarOT(Int32 areaSelecionada, Int32 nlenr, String codMaterial, Int32 qtdMAterial)
         at testeDoTeste1.ServiceReference1.Service1Client.CriarOT(Int32 areaSelecionada, Int32 nlenr, String codMaterial, Int32 qtdMAterial) in c:\Users\Documents\Visual Studio 2012\Projects\testeDoTeste1\testeDoTeste1\Service References\ServiceReference1\Reference.cs:line 119
         at testeDoTeste1.Program.Main(String[] args) in c:\Users\Documents\Visual Studio 2012\Projects\testeDoTeste1\testeDoTeste1\Program.cs:line 16
         at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
         at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
         at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
         at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
         at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
         at System.Threading.ThreadHelper.ThreadStart()
    InnerException: 
  </code></pre>
  
  <p>If I have failed in provide all necessary information, please, let me know: I will provide anything I can. I really need and apretiate all your help! Tks a lot! </p>
  
  <p><strong>--------------</strong></p>
  
  <p><strong>UPDATE 1</strong></p>
  
  <p>Since the WEB.CONFIG file is the only piece of the service that is edited to make the WCF service work with IIS Express I think this can (evetually) be the source of trouble. I`m posting the original WEB.CONFIG file, without the edits hoping that this can help someone spot the problem! </p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;configuration&gt;
    &lt;configSections&gt;
      &lt;sectionGroup name="SAP.Middleware.Connector"&gt;
        &lt;sectionGroup name="ClientSettings"&gt;
          &lt;section name="DestinationConfiguration" type="SAP.Middleware.Connector.RfcDestinationConfiguration, sapnco"/&gt;
        &lt;/sectionGroup&gt;
      &lt;/sectionGroup&gt;
    &lt;/configSections&gt;
    &lt;SAP.Middleware.Connector&gt;
      &lt;ClientSettings&gt;
        &lt;DestinationConfiguration&gt;
          &lt;destinations&gt;
            &lt;add NAME="QA" USER="XX" PASSWD="XX" CLIENT="XX" LANG="XX" ASHOST="XX" SYSNR="XX" MAX_POOL_SIZE="XX" IDLE_TIMEOUT="XX"/&gt;
          &lt;/destinations&gt;
        &lt;/DestinationConfiguration&gt;
      &lt;/ClientSettings&gt;
    &lt;/SAP.Middleware.Connector&gt;
    &lt;startup useLegacyV2RuntimeActivationPolicy="true"&gt;
      &lt;supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/&gt;
    &lt;/startup&gt;
    &lt;appSettings/&gt;
    &lt;system.web&gt;
      &lt;compilation targetFramework="4.0" debug="true"/&gt;
      &lt;httpRuntime/&gt;
    &lt;/system.web&gt;
    &lt;system.serviceModel&gt;
      &lt;behaviors&gt;
        &lt;serviceBehaviors&gt;
          &lt;behavior&gt;
            &lt;!-- To avoid disclosing metadata information, set the values below to false before deployment --&gt;
            &lt;serviceMetadata httpGetEnabled="true" httpsGetEnabled="true"/&gt;
            &lt;!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information --&gt;
            &lt;serviceDebug includeExceptionDetailInFaults="true"/&gt;
          &lt;/behavior&gt;
        &lt;/serviceBehaviors&gt;
      &lt;/behaviors&gt;
      &lt;protocolMapping&gt;
        &lt;add binding="basicHttpsBinding" scheme="https"/&gt;
      &lt;/protocolMapping&gt;
      &lt;serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true"/&gt;
    &lt;/system.serviceModel&gt;
    &lt;system.webServer&gt;
      &lt;modules runAllManagedModulesForAllRequests="true"/&gt;
      &lt;!--
          To browse web app root directory during debugging, set the value below to true.
          Set to false before deployment to avoid disclosing web app folder information.
        --&gt;
      &lt;directoryBrowse enabled="true"/&gt;
    &lt;/system.webServer&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p><strong>--------------</strong></p>
  
  <p><strong>UPDATE 2</strong></p>
  
  <p>Found a new error, but it`s still fuzzy to me: "{"Cannot get destination QA -- no destination configuration registered"}". This destination works fine in dev, so why it is not working on IIS Express?</p>
  
  <p>Anyways, here`s the complete exception: </p>
  
  <pre><code>System.ServiceModel.FaultException`1 was unhandled
    HResult=-2146233087
    Message=Cannot get destination QA -- no destination configuration registered
    Source=mscorlib
    StackTrace:
      Server stack trace: 
         at System.ServiceModel.Channels.ServiceChannel.ThrowIfFaultUnderstood(Message reply, MessageFault fault, String action, MessageVersion version, FaultConverter faultConverter)
         at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc&amp; rpc)
         at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
         at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs)
         at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
         at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
      Exception rethrown at [0]: 
         at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
         at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&amp; msgData, Int32 type)
         at testeDoTeste1.ServiceReference1.IService1.CriarOT(Int32 areaSelecionada, Int32 nlenr, String codMaterial, Int32 qtdMAterial)
         at testeDoTeste1.ServiceReference1.Service1Client.CriarOT(Int32 areaSelecionada, Int32 nlenr, String codMaterial, Int32 qtdMAterial) in c:\Users\Documents\Visual Studio 2012\Projects\testeDoTeste1\testeDoTeste1\Service References\ServiceReference1\Reference.cs:line 119
         at testeDoTeste1.Program.Main(String[] args) in c:\Users\Documents\Visual Studio 2012\Projects\testeDoTeste1\testeDoTeste1\Program.cs:line 16
         at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
         at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
         at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
         at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
         at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
         at System.Threading.ThreadHelper.ThreadStart()
    InnerException: 
  </code></pre>
  
  <p><strong>--------------</strong></p>