none
WCF + EF5 + Oracle issue! Cannot connect when deploying WCF service. RRS feed

  • Question

  • Good morning y'all!

    I'm getting a problem here that's making me nuts!!! 

    When I execute locally my service, everything works perfectly...but when I deploy my WCF to the server, well, it gives me an exception with something about the ProviderManifestToken string.

    One particular thing about my environment is that I connect my EF project with Oracle's library ODP.net. And as far as I can see, it's not so common people connecting this way.

    Well, bellow I'll show my web.config and the exception that's thrown:

    Web.config

    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
    <configSections>
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
    </configSections>
    <appSettings />
    <system.web>
    <httpRuntime />
    <pages controlRenderingCompatibilityVersion="4.0" />
    </system.web>
    <system.serviceModel>
    <services>
    <service name="ApuracaoAFDT.WCF.Servico">
    <endpoint address="" binding="basicHttpBinding" bindingConfiguration="StreamHttpBinding" contract="ApuracaoAFDT.WCF.IServico" />
    <endpoint address="mex" binding="mexHttpBinding" bindingConfiguration="" contract="IMetadataExchange" />
    </service>
    </services>
    <behaviors>
    <serviceBehaviors>
    <behavior>
    <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
    <serviceDebug includeExceptionDetailInFaults="false" />
    </behavior>
    </serviceBehaviors>
    </behaviors>
    <protocolMapping>
    <add binding="basicHttpsBinding" scheme="https" />
    </protocolMapping>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
    </system.serviceModel>
    <system.webServer>
    <modules runAllManagedModulesForAllRequests="true" />
    <directoryBrowse enabled="true" />
    </system.webServer>
    <connectionStrings>
    <add name="ApuracaoAFDT.WCF.Context.AFDTContext" providerName="Oracle.DataAccess.Client" connectionString="DATA SOURCE=datasource;USER ID=userID;PASSWORD=pass" />
    <add name="ApuracaoAFDT.WCF.Context.ORC0Context" providerName="Oracle.DataAccess.Client" connectionString="DATA SOURCE=datasource;USER ID=userID;PASSWORD=pass" />
    </connectionStrings>
    <system.diagnostics>
    <trace autoflush="true" indentsize="4">
    <listeners>
    <add name="myListener" type="System.Diagnostics.TextWriterTraceListener" initializeData="application.log" />
    <remove name="Default" />
    </listeners>
    </trace>
    </system.diagnostics>
    <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
    <dependentAssembly>
    <assemblyIdentity name="EntityFramework" publicKeyToken="b77a5c561934e089" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-5.0.0.0" newVersion="5.0.0.0" />
    </dependentAssembly>
    </assemblyBinding>
    </runtime>
    </configuration>

    Exception:

    Occurred in: 29/04/2013 16:31:35
    Exception: An error occurred while getting provider information from the database. This can be caused by Entity Framework using an incorrect connection string. Check the inner exceptions for details and ensure that the connection string is correct.
    Inner exception: The provider did not return a ProviderManifestToken string.
    Stack trace:    at System.Data.Entity.ModelConfiguration.Utilities.DbProviderServicesExtensions.GetProviderManifestTokenChecked(DbProviderServices providerServices, DbConnection connection)
       at System.Data.Entity.ModelConfiguration.Utilities.DbConnectionExtensions.GetProviderInfo(DbConnection connection, DbProviderManifest& providerManifest)
       at System.Data.Entity.DbModelBuilder.Build(DbConnection providerConnection)
       at System.Data.Entity.Internal.LazyInternalContext.CreateModel(LazyInternalContext internalContext)
       at System.Data.Entity.Internal.RetryLazy`2.GetValue(TInput input)
       at System.Data.Entity.Internal.LazyInternalContext.InitializeContext()
       at System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType)
       at System.Data.Entity.Internal.Linq.InternalSet`1.Initialize()
       at System.Data.Entity.Internal.Linq.InternalSet`1.GetEnumerator()
       at System.Data.Entity.Infrastructure.DbQuery`1.System.Collections.Generic.IEnumerable<TResult>.GetEnumerator()
       at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
       at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
       at ApuracaoAFDT.WCF.Base.RepositoryBase`1.Get(Expression`1 filter, Func`2 orderBy, String includeProperties)
       at ApuracaoAFDT.WCF.Apuracao.ObterTodosPorCentroCusto(String centroCusto)
    --------------------------------------------------------------------------------

    EDIT: this is the main part of my client side class...is there anything wrong with it?!

        internal static class WCFApuracao
        {
            #region Membros

            private static WCF_Apuracao.ApuracaoClient m_WCF;
            private static string m_enderecoServidor;

            public static ApuracaoClient Wcf
            {
                get { return m_WCF ?? new ApuracaoClient("BasicHttpBinding_IApuracao", Settings.Default.EnderecoServidor + "Apuracao/Apuracao/"); }
                set { m_WCF = value; }
            }

            #endregion

            #region Construtor
            
            internal static List<AFDTFunc> ListarTodosPorCentroCusto(string obra)
            {
                try
                {
                    var listaFuncionarios = Wcf.ObterTodosPorCentroCusto(obra).ToList();
                    return listaFuncionarios;
                }
                catch (WebException ex)
                {
                    Wcf = null;
                    AppUtil.GerarLogErro(ex);
                    throw new WebException("Não foi possível pegar os dados do servidor.");
                }
                catch (Exception ex)
                {
                    Wcf = null;
                    AppUtil.GerarLogErro(ex);
                    throw new WebException("Erro ao obter uma lista de funcionário.\r\n" + ex.Message);
                }
            }

    END EDIT

    I would really appretiate if some of you could help me with this issue.

    Regards,

    Davi Rodrigues


    • Edited by DaviARodrigues Tuesday, April 30, 2013 2:15 PM put the main part of my client side class
    Tuesday, April 30, 2013 11:14 AM

Answers

  • Look at this..

    Verify "Building the model" section in below link.

    http://blog.oneunicorn.com/2012/04/21/code-first-building-blocks/

    Thanks.


    Happy Coding, Kishore.

    Tuesday, April 30, 2013 5:01 PM

All replies

  • Hello..

    Try using "System.Data.OracleClient" for providerName in ConnectionString.

    Thanks.


    Happy Coding, Kishore.


    • Edited by KoyaKishore Tuesday, April 30, 2013 1:05 PM
    Tuesday, April 30, 2013 1:03 PM
  • Hello Koya,

    At least until now, no deal, my friend...I mean, the exception changed, but I'm really working with THAT specific oracle connection library...

    Regards!

    Tuesday, April 30, 2013 2:06 PM
  • Hi..

    Check out this link. This may help you.!!

    http://www.codeproject.com/Tips/524041/Entity-Framework-ProviderManifestToken-not-valid

    Thanks.


    Happy Coding, Kishore.

    Tuesday, April 30, 2013 3:21 PM
  • Hey mate, this is a good choice, but assuming that I've created my EF project with Code First...I guess it won't work...

    Thanks!!!

    Tuesday, April 30, 2013 4:17 PM
  • Look at this..

    Verify "Building the model" section in below link.

    http://blog.oneunicorn.com/2012/04/21/code-first-building-blocks/

    Thanks.


    Happy Coding, Kishore.

    Tuesday, April 30, 2013 5:01 PM