none
Entity Data Model Deployment Error - "The specified metadata path is not valid. A valid path must be either an existing directory, an existing file with extension '.csdl', '.ssdl', or '.msl', or a URI that identifies an embedded resource." RRS feed

  • Question

  • Hi Guys,

    I have developed one web application using .NET 4.0 (Asp.NET,C#), Entity Framework 4.0

    In which I create one Entity data model.

    Than after I was Compile it and deploy/upload all my code on webserver. Here I changed connectionstring in webconfig.  But when my pages try to access database at that time it throws following error

    "The specified metadata path is not valid. A valid path must be either an existing directory, an existing file with extension '.csdl', '.ssdl', or '.msl', or a URI that identifies an embedded resource."

    I was tried lots of different option with Constr in webconfig but it’s not working. Following are few examples of connection string which I already tried.

    <connectionStrings>

        <add name="BlazonBazaarEntities" connectionString="Metadata=res://../App_Code.dll/BlazonBazaarEDM.csdl|res://../App_Code.dll/BlazonBazaarEDM.ssdl|res://../App_Code.dll/BlazonBazaarEDM.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=ABCSERVER\SQLEXPRESS;Integrated Security=False;User ID=admin;password=123456;Connect Timeout=15;Encrypt=False;Packet Size=4096&quot;" providerName="System.Data.EntityClient" />

        <add name="BlazonBazaarEntities22" connectionString="metadata=res://App_Code,Version=1.0.0.0,Culture=neutral,PublicKeyToken=null/BlazonBazaarEDM.csdl|res://App_Code,Version=1.0.0.0,Culture=neutral,PublicKeyToken=null/BlazonBazaarEDM.ssdl|res://App_Code,Version=1.0.0.0,Culture=neutral,PublicKeyToken=null/BlazonBazaarEDM.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=ABCSERVER\SQLEXPRESS;Integrated Security=False;User ID=admin;password=123456;Connect Timeout=15;Encrypt=False;Packet Size=4096&quot;" providerName="System.Data.EntityClient" />   

        <add name="BlazonBazaarEntities222" connectionString="Metadata=C:\HostingSpaces\BlazonBazaarEDM\BlazonBazaarEDM.com\wwwroot\bin\App_Code.BlazonBazaarEDM.csdl|C:\HostingSpaces\BlazonBazaarEDM\BlazonBazaarEDM.com\wwwroot\bin\App_Code.BlazonBazaarEDM.ssdl|C:\HostingSpaces\BlazonBazaarEDM\BlazonBazaarEDM.com\wwwroot\bin\App_Code.BlazonBazaarEDM.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=ABCSERVER\SQLEXPRESS;Integrated Security=False;User ID=admin;Password=123456;Connect Timeout=15;Encrypt=False;Packet Size=4096&quot;" providerName="System.Data.EntityClient"/>

        <add name="BlazonBazaarEntities3" connectionString="Metadata=~/App_Code/BlazonBazaarEDM.csdl|~/App_Code/App_Code.BlazonBazaarEDM.ssdl|~/App_Code/App_Code.BlazonBazaarEDM.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=ABCSERVER\SQLEXPRESS;Integrated Security=False;User ID=admin;Password=123456;Connect Timeout=15;Encrypt=False;Packet Size=4096&quot;" providerName="System.Data.EntityClient" />

        <add name="BlazonBazaarEntities4" connectionString="Metadata=C:\HostingSpaces\BlazonBazaarEDM\BlazonBazaarEDM.com\wwwroot\App_Code\BlazonBazaarEDM.csdl|C:\HostingSpaces\BlazonBazaarEDM\BlazonBazaarEDM.com\wwwroot\App_Code\BlazonBazaarEDM.ssdl|C:\HostingSpaces\BlazonBazaarEDM\BlazonBazaarEDM.com\wwwroot\App_Code\BlazonBazaarEDM.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=ABCSERVER\SQLEXPRESS;Integrated Security=False;User ID=admin;Password=123456;Connect Timeout=15;Encrypt=False;Packet Size=4096&quot;" providerName="System.Data.EntityClient"/>

        <add name="BlazonBazaarEntities5" connectionString="Metadata=..\App_Code\BlazonBazaarEDM.csdl|..\App_Code\BlazonBazaarEDM.ssdl|..\App_Code\BlazonBazaarEDM.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=ABCSERVER\SQLEXPRESS;Integrated Security=False;User ID=admin;Password=123456;Connect Timeout=15;Encrypt=False;Packet Size=4096&quot;" providerName="System.Data.EntityClient" />

        <add name="BlazonBazaarEntities6" connectionString="Metadata=..\App_Code.BlazonBazaarEDM.csdl|..\App_Code.BlazonBazaarEDM.ssdl|..\App_Code.BlazonBazaarEDM.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=ABCSERVER\SQLEXPRESS;Integrated Security=False;User ID=admin;Password=123456;Connect Timeout=15;Encrypt=False;Packet Size=4096&quot;" providerName="System.Data.EntityClient" />

        <add name="BlazonBazaarEntities7" connectionString="Metadata=..\..\App_Code\BlazonBazaarEDM.csdl|..\..\App_Code\BlazonBazaarEDM.ssdl|..\..\App_Code\BlazonBazaarEDM.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=ABCSERVER\SQLEXPRESS;Integrated Security=False;User ID=admin;Password=123456;Connect Timeout=15;Encrypt=False;Packet Size=4096&quot;" providerName="System.Data.EntityClient" />

        <add name="BlazonBazaarEntities8" connectionString="Metadata=App_Code\BlazonBazaarEDM.csdl|App_Code\BlazonBazaarEDM.ssdl|App_Code\BlazonBazaarEDM.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=ABCSERVER\SQLEXPRESS;Integrated Security=False;User ID=admin;Password=123456;Connect Timeout=15;Encrypt=False;Packet Size=4096&quot;" providerName="System.Data.EntityClient" />

        <add name="BlazonBazaarEntities9" connectionString="Metadata=.\BlazonBazaarEDM.csdl|.\BlazonBazaarEDM.ssdl|.\BlazonBazaarEDM.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=ABCSERVER\SQLEXPRESS;Integrated Security=False;User ID=admin;Password=123456;Connect Timeout=15;Encrypt=False;Packet Size=4096&quot;" providerName="System.Data.EntityClient" />

      </connectionStrings>



    Just check out from your side and let me know if you get something for me.

    Thanks
    Rushit

    Wednesday, July 6, 2011 11:34 AM

Answers

All replies

  • Hi,
    Your connectionstring depends on what your Metadata Artifact Processing configuration in your edmx. If you have embedded it into the assempbly you should use 
    Metadata=res://*/BlazonBazaarEDM.csdl|res://*/BlazonBazaarEDM.ssdl|res://*/BlazonBazaarEDM.msl
    

    otherwise the last one (BlazonBazaarEntities9 should work.

    --Rune
    Wednesday, July 6, 2011 2:29 PM
  • Hi Rune,

     

    Thanks for your comment.

    Yes you are right that connection string is depends on Metadata Artifact Processing configuration in your edmx. And i set that configuration to "Embed in Output Assembly".

    But the option which you mentioned is also not working. When i am using that option at that time it throws " Unable to load the specified metadata resource." error.

    So let me know if you have any idea about it.

     

    Regards,

    Rushit

     

     

    Wednesday, July 6, 2011 6:26 PM
  • Hmm..

    Is your model placed in some kind of folder in your project? if so, you must add this to the filepath to, after res://*/.

    The problem is that you have modified your connectiion string to much.

    You could try in visual studio to remove the connectionstring from your appconfig/web.config and select update database once more when you are in your model. EF will then recreate the connectionstring for you.


    --Rune
    Wednesday, July 6, 2011 6:53 PM
  • Hi,

     

    Option which you told me in last reply is mentioned below. I put .edmx file in App_Code folder after publishing website it create one .dll file in bin/App_Code.dll. I tried out following ConStr.

     

    <add name="BlazonBazaarEntities" connectionString="Metadata=res://*/App_Code.dll/BlazonBazaarEDM.csdl|res://*/App_Code.dll/BlazonBazaarEDM.ssdl|res://*/App_Code.dll/BlazonBazaarEDM.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=ABCSERVER\SQLEXPRESS;Integrated Security=False;User ID=admin;password=123456;Connect Timeout=15;Encrypt=False;Packet Size=4096&quot;" providerName="System.Data.EntityClient" />

     

    -Rushit

     

     

    Thursday, July 7, 2011 4:37 AM
  • Hi,

    Remove .dll from the path... It's the foldername, not the dllname you want.

    <add name="BlazonBazaarEntities" connectionString="Metadata=res://*/App_Code/BlazonBazaarEDM.csdl|res://*/App_Code/BlazonBazaarEDM.ssdl|res://*/App_Code/BlazonBazaarEDM.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=ABCSERVER\SQLEXPRESS;Integrated Security=False;User ID=admin;password=123456;Connect Timeout=15;Encrypt=False;Packet Size=4096&quot;" providerName="System.Data.EntityClient" />
    


    --Rune
    Thursday, July 7, 2011 7:56 AM
  • Hi,

     

    That was by mistake original one is mentioned below.

     

    <add name="BlazonBazaarEntities" connectionString="Metadata=res://*/App_Code/BlazonBazaarEDM.csdl|res://*/App_Code/BlazonBazaarEDM.ssdl|res://*/App_Code/BlazonBazaarEDM.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=ABCSERVER\SQLEXPRESS;Integrated Security=False;User ID=admin;password=123456;Connect Timeout=15;Encrypt=False;Packet Size=4096&quot;" providerName="System.Data.EntityClient" />

     

    - Rushit

    Thursday, July 7, 2011 10:57 AM
  • Ahh... Sorry.... I misread with all slashes etc :)

    After App_Code use a . (dot) instead of a / (slash)!

    <add name="BlazonBazaarEntities" connectionString="Metadata=res://*/App_Code.BlazonBazaarEDM.csdl|res://*/App_Code.BlazonBazaarEDM.ssdl|res://*/App_Code.BlazonBazaarEDM.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=ABCSERVER\SQLEXPRESS;Integrated Security=False;User ID=admin;password=123456;Connect Timeout=15;Encrypt=False;Packet Size=4096&quot;" providerName="System.Data.EntityClient" />
    
    


    --Rune
    Thursday, July 7, 2011 5:33 PM
  • Sorry dear i tried that too .. bust not getting any positive result .. :(
    Saturday, July 9, 2011 6:02 AM
  • Then I don't have any idea.. Sorry...
    --Rune
    Saturday, July 9, 2011 7:05 AM
  • Hi,

     

    That was by mistake original one is mentioned below.

     

    <add name="BlazonBazaarEntities" connectionString="Metadata=res://*/App_Code/BlazonBazaarEDM.csdl|res://*/App_Code/BlazonBazaarEDM.ssdl|res://*/App_Code/BlazonBazaarEDM.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=ABCSERVER\SQLEXPRESS;Integrated Security=False;User ID=admin;password=123456;Connect Timeout=15;Encrypt=False;Packet Size=4096&quot;" providerName="System.Data.EntityClient" />

     

    - Rushit

    Here's the detailed link for this. http://msdn.microsoft.com/en-us/library/cc716677.aspx Or you can point out the absoluted path in your project. like this. http://social.msdn.microsoft.com/Forums/en-US/adodotnetentityframework/thread/e2d6f829-0703-47cc-b23a-25f563c25712/

    Thanks,

    Esters,


    Just a newbie for everything.
    Monday, July 11, 2011 10:45 AM