C# MVC project, adding a service reference E_INVALIDARG


When trying to add a service reference I receive the following error:

"The configuration for the service reference could not be added due to the following issue: An error occurred creating the configuration section handler for system.serviceModel/bindings: The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG)) (C:\....\web.config line 154)"

But, looking in web.config I am not seeing the problem.

Thanks. :)
Adam DIT Solutions DeveloperAsked:
Who is Participating?
Miguel OzConnect With a Mentor Software EngineerCommented:
Sometimes serviceModel section is in the way of your reference updating the web.config.  Please try:
1. Remove all  temporary framework files for your project and also your bin and obj folders
2. Backup your web.config to a save location.
3. Build project
4. At project  web.config: Remove system.serviceModel section and save the web.config without the service model section.
5. Add service reference.
6. From your backup pasted the service model section back to project web.config,. (if your service reference change it make sure you merge contents)
7. Build and run project.
Adam DIT Solutions DeveloperAuthor Commented:
Thanks for the help Miguel.  Deleting the entire servicemodel section allowed the new reference to be created and the error to be found.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.