top of page
  • 執筆者の写真Kawahara

‘TestService’ を参照する既定のエンドポイント要素が見つかりませんでした

VisualStudio2012にてTestServiceというWebサービスを利用したクラスライブラリをASP.MVCのプロジェクトから照会した際に下記のエラーが実行時に発生。

‘TestService’ を参照する既定のエンドポイント要素が見つかりませんでした

クラスライブラリのapp.configをASP.MVCプロジェクトのWeb.configへコピー。その後、一部調整することで解決した。

クラスライブラリ名のWeb.config側(namespace名)に設定しないとダメな模様。また、Web.configを変更する=ASP.NET開発サーバーの再起動が必要と思われるので注意。

クラスライブラリ(TestLib)のapp.config

<?xml version=”1.0″ encoding=”utf-8″ ?> <configuration> <system.serviceModel> <bindings> <basicHttpBinding> <binding name=”TestUtilSoap” /> </basicHttpBinding> </bindings> <client> <endpoint address=”http://www.example.com/TestService/TestUtil.asmx&#8221; binding=”basicHttpBinding” bindingConfiguration=”TestUtilSoap” contract=”WsTestUtil.TestUtilSoap” name=”TestUtilSoap” /> </client> </system.serviceModel> </configuration>

ASP.MVCプロジェクトのWeb.config

<system.serviceModel> <bindings> <basicHttpBinding> <binding name=”TestLib.TestUtilSoap” /> </basicHttpBinding> </bindings> <client> <endpoint address=”http://www.example.com/TestService/TestUtil.asmx&#8221; binding=”basicHttpBinding” bindingConfiguration=”TestLib.TestUtilSoap” contract=”WsTestUtil.TestUtilSoap” name=”TestLib.TestUtilSoap” /> </client> </system.serviceModel>

閲覧数:1,062回0件のコメント

最新記事

すべて表示

@Html.DropDownListで「同一のキーを含む項目が既に追加されています。」

@Html.DropDownListにて「同一のキーを含む項目が既に追加されています。」とのエラー。 勝手に、KeyがユニークならValueは重なっても良いと思い込んでいた。【エラー発生ケース】 <%= @Html.DropDownList(“select-test”, new SelectList(new Dictionary<string, int> {{” – “, -1 },{“あ”, 1

C#にてPDFファイルを結合

複数のPDFファイル一つのファイルにまとめるにはiTextSharpを使う。こちらを参考にさせて頂きました。これによって、結合できるがWebアプリ上でテンポラリファイルを生成とかカッコ悪い。 ということで、MemoryStreamに対応させました。が・・・copy.close時にMemoryStreamが閉じられてしまう。とりあえず、doc.close();とcopy.close();をコメントに

bottom of page