locked
Deploy WCF with Entity Framework to IIS RRS feed

  • Question

  • Hi,

     

    I have a Web Service with Entity Framework. My program works fine under the Visual Studio 2010 test system. Now I tried to deploy it to IIS. However it seems my entity connection settings isn't deployed. In my webservic app.config there is a connectionstring. I created a new website project within the solution but I couldn't connect to it with my client after I deployed the WS to IIS. I got an error:

    The specified named connection is either not found in the configuration, not intended to be used with the EntityClient provider, or not valid.

    On forums I saw this is because of the entity connection problems. I manually updated the published web.config with my entity connectionstring parameter and now I get this error:

    The underlying provider failed on Open.

     

    I'm newbie to programming. Please could someone help me how could I publish my webservice to IIS? What shold I config to my client will be able to connect to the web service? My client is a WPF application which works fine under the VS 2010 test system. Should I post some config settings or code snippets?

     

    Thanks,

    G

     

    Edit: I tested my webservice as I sw in some tutorial:

    http://localhost/mywebapp/myservice.svc works

    wcftestclient.exe http://localhost/mywebapp/myservice.svc works

    It seems the web service works but the problem is related to entity framework config. May be I'm wrong...

    The program will later be used in a domain environment hosted on a 2008 R2 server with SQL 2008 R2 and the client will run on win 7 clients but now the whole system is developed and tested on a workgroup enviroment. The SQL DB IIS and the client runs on the same machine during the development and test period.

    • Edited by Homecsiga Monday, October 4, 2010 10:47 AM some more info
    Monday, October 4, 2010 10:42 AM

Answers

  • Hi,

    From your description it's not a WCF but an Entity Framework connection config missing issue. Please make sure you've specified the connection string in web.config like below:

    <configuration>
        <connectionStrings>
        <add name="YourEntitiesName" connectionString="metadata=res://*/YourModel.csdl|res://*/YourModel.ssdl|res://*/YourModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;Your Data Base Connection String&quot;" providerName="System.Data.EntityClient" />
      </connectionStrings>


    Please remember to mark the replies as answers if they help and unmark them if they provide no help. Windows Azure Platform China Blog: http://blogs.msdn.com/azchina/default.aspx
    Thursday, October 7, 2010 3:50 AM

All replies

  • Hi,

    From your description it's not a WCF but an Entity Framework connection config missing issue. Please make sure you've specified the connection string in web.config like below:

    <configuration>
        <connectionStrings>
        <add name="YourEntitiesName" connectionString="metadata=res://*/YourModel.csdl|res://*/YourModel.ssdl|res://*/YourModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;Your Data Base Connection String&quot;" providerName="System.Data.EntityClient" />
      </connectionStrings>


    Please remember to mark the replies as answers if they help and unmark them if they provide no help. Windows Azure Platform China Blog: http://blogs.msdn.com/azchina/default.aspx
    Thursday, October 7, 2010 3:50 AM
  • I have a similar issue, in my case there is no error but I can't get data after I publish the WCF service in IIS. Everything was working perfect when I use ASP.NET development invironment (in VS 2010), I used windows authentication for accesing my database, does it matter with the ADO.Net Entityframework wizard generating the connection string?

     

    Wednesday, February 16, 2011 9:09 PM
  • Yay!! Got it working when I use SQL Server autherntication, but still wonder why it doesn't work for windows authentication.
    Wednesday, February 16, 2011 10:01 PM