質問

私のweb.configの変換は公開されていません - そして、エラーは私が得ているこれらの警告に関係していると思います。

Visual Studio 2010を使用して、私は自分と遊んでいます Web.Config / Web.Config.Debug ファイル。

私の中で .Debug ファイル、次の警告が何度もリストされています。

No element in the source document matches '/configuration'

それぞれにリストしていると思います セクション それはに存在します .Debug ファイル。

したがって、次のサンプルweb.config.debugファイルを使用すると、2回リストされます。 (私は推測しています、最初のものは目です <connectionStrings>..</> 2つ目は次のとおりです <system.webServer>...</.> )

<?xml version="1.0"?>

<!-- For more information on using web.config transformation visit http://go.microsoft.com/fwlink/?LinkId=125889 -->

<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform" xdt:SupressWarnings="false">

    <connectionStrings>
        <add name="Foo" connectionString="Server=foo;Database=Foo;uid=foo;password=foo" providerName="System.Data.SqlClient"
            xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
    </connectionStrings>

    <system.webServer>
        <httpProtocol>
            <customHeaders>
                <clear />
                <add name="ETag" value="Dev_IIS" xdt:Transform="SetAttributes" xdt:Locator="Match(name)" />
            </customHeaders>
        </httpProtocol>
    </system.webServer>

</configuration>

誰でも助けてくれませんか?

役に立ちましたか?

解決

私は見つけました このブログ投稿 これは、変圧器がxmlns =属性で窒息していることを示唆しています。

これからweb.configファイルを変更しました。

<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
  <connectionStrings>
    etc...

これに:

<configuration>
  <connectionStrings>
    etc...

...そして見よ、それは機能します!

他のヒント

新しいWebアプリケーションプロジェクト(ターゲット.NET 4.0)を作成し、web.release.configを変更して、上記のものを正確に含めました。それから私はweb.configに行き、以下を追加しました:

    <add name="ApplicationServices"
         connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnetdb.mdf;User Instance=true"
         providerName="System.Data.SqlClient" />
    <add name="Foo" />  <------------------------added this
  </connectionStrings>

次に、構成を変更してWebアプリケーションをリリースして公開しました。公開されたアプリケーションには、Web.configに以下が含まれていました

<add name="ApplicationServices"
     connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnetdb.mdf;User Instance=true"
     providerName="System.Data.SqlClient" />
<add name="Foo"
     connectionString="Server=foo;Database=Foo;uid=foo;password=foo"
     providerName="System.Data.SqlClient" />  <-------this got added

ですから、あなたの場合の問題がどこにあるのかわかりません。

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top