JP Hellemons
JP Hellemons

Reputation: 6057

Visual Studio cannot remove Service Reference

I am using vs2013 and vs2015 and cannot remove the service references:

enter image description here

a normal right click and then delete show do the job (or the delete key on the keyboard when selected) But I get:

enter image description here

The configuration for the service reference could not be deleted due to the following issue: An error occurred creating the configuration section handler for system.serviceModel/bindings: AssemblyResolveEvent handlers cannot return Assemblies loaded for reflection only.

Here is the part of my web.config (line 249 and more)

<system.serviceModel>
<bindings>
  <basicHttpBinding>
    <binding name="PayPalAPISoapBinding">
      <security mode="Transport" />
    </binding>
    <binding name="PayPalAPIAASoapBinding">
      <security mode="Transport" />
    </binding>
    <binding name="PayPalAPISoapBinding1" />
    <binding name="PayPalAPIAASoapBinding1" />
    <binding name="PayPalAPISoapBinding2">
      <security mode="Transport" />
    </binding>
    <binding name="PayPalAPIAASoapBinding2">
      <security mode="Transport" />
    </binding>
    <binding name="PayPalAPISoapBinding3" />
    <binding name="PayPalAPIAASoapBinding3" />
  </basicHttpBinding>
</bindings>
<client>
  <endpoint address="https://api.sandbox.paypal.com/2.0/" binding="basicHttpBinding" bindingConfiguration="PayPalAPISoapBinding" contract="PayPalSvc.PayPalAPIInterface" name="PayPalAPI" />
  <endpoint address="https://api-aa.sandbox.paypal.com/2.0/" binding="basicHttpBinding" bindingConfiguration="PayPalAPIAASoapBinding" contract="PayPalSvc.PayPalAPIAAInterface" name="PayPalAPIAA" />
  <endpoint address="https://api.sandbox.paypal.com/2.0/" binding="basicHttpBinding" bindingConfiguration="PayPalAPISoapBinding2" contract="PayPalLive.PayPalAPIInterface" name="PayPalAPI1" />
  <endpoint address="https://api-aa-3t.sandbox.paypal.com/2.0/" binding="basicHttpBinding" bindingConfiguration="PayPalAPIAASoapBinding2" contract="PayPalLive.PayPalAPIAAInterface" name="PayPalAPIAA1" />
</client>
</system.serviceModel>

I referenced the WSDL from paypal years ago and rebuild the whole thing using the nuget package (REST instead of the old soap api)

But I cannot cleanup the old wsdl code and (service)references. I got the same error if I deleted the web.config part and deleted the reference afterwards.

Upvotes: 3

Views: 6226

Answers (2)

Dmitri M
Dmitri M

Reputation: 1166

Delete web.config then delete the service reference. Restore the web.config afterwards and clean up any binding references.

Upvotes: 0

JP Hellemons
JP Hellemons

Reputation: 6057

Steps to manually fix it:

  • Removed the client and bindings part from the system.serviceModel in the web.config manually.

  • Removed the service reference dir from the filesystem

  • manually edited my *.csproj file. (Searched for paypal and removed everything except the new nuget reference. Also removed the "service reference" reference from the csproj.)

Upvotes: 5

Related Questions