3

MVC 3 プロジェクトを公開しようとしていますが、接続文字列が間違っているため、(EF を使用して) SQL サーバーに接続できません。ここにあります:

  <add name="PackStoreEntities" connectionString="metadata=res://*/Models.PackStore.csdl|res://*/Models.PackStore.ssdl|res://*/Models.PackStore.msl;provider=System.Data.SqlClient;provider connection string=&quot;workstation id=PackStore.mssql.somee.com;packet size=4096;user id=*****;pwd=****;data source=PackStore.mssql.somee.com;persist security info=False;initial catalog=PackStore&quot;" providerName="System.Data.EntityClient" />

私は私のホスティング会社からこの部分を取りました:

workstation id=PackStore.mssql.somee.com;packet size=4096;user id=*****;pwd=****;data source=PackStore.mssql.somee.com;persist security info=False;initial catalog=PackStore

Mvc プロジェクトはローカル サーバー上で正常に動作しますが、公開時に "Keyword not supported: 'metadata'" が表示されます。私の間違いはどこですか?答えてくれてありがとう。

4

7 に答える 7

4

これを試してください...

<add name="PackStoreEntities" connectionString="metadata=res://*;provider=System.Data.SqlClient;provider connection string='Data Source=PackStore.mssql.somee.com;Initial Catalog=PackStore;User ID=***;Password=****;'"  providerName="System.Data.EntityClient" />

編集..

<add name="PackStoreEntities" connectionString="metadata=res://*;provider=System.Data.SqlClient;provider connection string='workstation id=PackStore.mssql.somee.com;packet size=4096;user id=*****;pwd=****;data source=PackStore.mssql.somee.com;persist security info=False;initial catalog=PackStore;'" providerName="System.Data.EntityClient" />
于 2012-04-21T11:06:16.797 に答える
2

接続文字列を修正した後でも、Linq To Sql から Entity フレームワークへの変換中にこのエラーが発生しました。一部の asp:SqlDataSource コントロールを asp:EntityDataSource に切り替える必要があることが判明しました。

前:

    <asp:SqlDataSource ID="SqlDataSourceProducts" runat="server" SelectCommand="SELECT Id, Description FROM [Product]"
        ConnectionString="<%$ ConnectionStrings:crmConnectionString %>" CacheDuration="5" CacheExpirationPolicy="Absolute">
    </asp:SqlDataSource>

後:

    <asp:EntityDataSource ID="SqlDataSourceProducts" runat="server" Select="Id, Description"
        EntitySetName="Products" ConnectionString="<%$ ConnectionStrings:crmConnectionString %>" DefaultContainerName="CRM" >
    </asp:EntityDataSource>
于 2013-01-02T21:33:20.440 に答える
0

同様の問題がありましたが、someeサーバーからの接続文字列は2つの間にある必要があるよう&quot; です。変更したのはそれだけで、動作します...

于 2013-09-15T05:04:32.303 に答える
0

接続文字列からメタ データを削除します。これは、ローカル デバッグ専用です。オンライン申請の場合、それは必要ありません。

naim で指定された接続文字列を試してください

于 2012-04-21T11:14:35.437 に答える