34

When trying to update a service reference in a class library (VS2013), i get the following error.

"The configuration for the service reference could not be updated 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."

This same error happens when i try to delete the reference as well.

Any help in sorting would be greatly appreciated.

1
  • I have started getting the same issue since installing update 2 for VS2013. My colleagues uninstalled the update which resolved the problem, but took hours. I'm hoping to avoid that complete waste of time.
    – gwhn
    May 23, 2014 at 12:22

4 Answers 4

82

I've had the same issue after updating to VS2013 Update 2.

I've solved the issue by temporarily cutting the whole system.serviceModel section out of web.config, pasting it somewhere else like Notepad. Then, I've saved the web.config without the service model section. Then, I was able to update the service reference successfully. After updating the service reference, I've pasted the service model section back to web.config and it worked successfully.

5
  • 1
    Doesn't make any sense, but that helped! Thanks!
    – Vad
    Jun 18, 2016 at 3:01
  • @Vad yeah didn't make any sense to me either. Probably something buggy with the internal caching of VS itself. Jun 18, 2016 at 9:58
  • 1
    The solution works for me in Visual Studio 2015 Update 3
    – Henrik
    Sep 27, 2016 at 9:38
  • 1
    Those solutions that doesn't make sense, but they work. Thank you, it worked for me. Nov 4, 2016 at 13:02
  • I was getting a similar error message but with "Unable to open configSource file xxx.config", and this solution worked for me also. Thanks!
    – Neo
    Oct 6, 2017 at 14:19
21

I was able to work around this similarly to Can by temporarily removing the extensions element of the system.serviceModel section and any associated extension elements. In my case the extensions were Azure Service Bus extensions.

1
  • 1
    Had the same problem. To me it seems like the process of adding a service Reference crashes if there exists any system.serviceModel configurations in the web.config/app.config. So if you e.g. first added Azure Service Bus Extensions nuget package and then tried to add the service Reference, it fails. The other way around it Works. If you remove the package, the config settings are kept, so you have to manually remove the system.serviceModel tags and everything inside it. Then you can add Your service Reference and finally the extension package.
    – TMan
    Sep 2, 2015 at 13:43
0

In my experience it has been as simple as to delete the service reference and re-adding it. For example, last time it happened it was on a WebService (not WCF, the old one), and the error started appearing after we changed one of the classes that was being sent as a return from different routines/functions. After adding one more property to the class, it started going crazy and prompting errors everywhere. Just a simple Delete and re-Add Service Reference did the trick.

0

Only need to one time remove <system.serviceModel> section from web.config. After Create first service refrence , this section rebuild by Vs.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.