0

I have a problem really similar to a lot of other questions in this forum, but neiter of the solutions work for me - perhaps because I don't get them.

I have a VERY simple ASP.NET web service with just 4 simple methods. To test it, I connected to it from a newly created Console Application and it works absolutely perfect - just added the URL and had Visual Studio generate the client code (it generated 2 end points of which I needed to delete 1 in order to make it work, by I guess that's not important).

Then I tried doing the same thing in a User Control project (meaning that it's a class library). Then suddenly it throws an exception with a message like the on in the title of this questions.

I run the user control project locally in Visual Studio since it is still being tested.

I even tried copy/pasting the service model section from the other project (where it worked) into my app.config of the user control project - still not working.

Any ideas?

EDIT: This is the servicemodel section of the app.config file

  <system.serviceModel>
<bindings>
  <basicHttpBinding>
    <binding name="Service1Soap" />
  </basicHttpBinding>
  <customBinding>
    <binding name="Service1Soap12">
      <textMessageEncoding messageVersion="Soap12" />
      <httpTransport />
    </binding>
  </customBinding>
</bindings>
<client>
  <endpoint address="http://localhost:49737/Service1.asmx" binding="basicHttpBinding"
    bindingConfiguration="Service1Soap" contract="ServiceReference1.Service1Soap"
    name="Service1Soap" />
</client>

4

2 に答える 2

0

@kevin johnson:「ユーザー制御プロジェクト」の意味がわかりません。作業中のプロジェクトからapp.configにサービスモデル構成をコピーして貼り付けると機能しません。これは、Webサービスを使用する必要がある場合は、次のいずれかを行う必要があるためです。svcutil.exeから生成されるアプリ構成ファイルを使用して参照ファイルを追加するか、「サービス参照」として既存のプロジェクトにWebサービスを追加することにより、構成ファイル(app.configまたはweb.config)を変更しようとしないでください。あなたのしている。

于 2013-02-12T10:37:46.730 に答える