Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Purpose of ClientSettingsProvider.ServiceUri in app.config

Tags:

.net

wcf

What does

<appSettings>
    <add key="ClientSettingsProvider.ServiceUri" value=""/>
</appSettings>

do?

Since the value is empty string, can I remove the element?

like image 648
linquize Avatar asked Aug 15 '12 02:08

linquize


3 Answers

This has to do with ASP/Ajax Client Application Services (http://msdn.microsoft.com/en-us/library/bb384297(v=vs.100).aspx)

I too encountered this code in my app.config file and was confused since I've developed our entire application from scratch, and didn't add this.

What I discovered was that this line (and others under the tags) are added automatically to a project's app.config file when the "Enable client application services" checkbox is checked. It turned out mine was, though I still have no idea why or how this happened.

To see if this option is selected in your project(s), right click on a project and select "Properties". Navigate to the "Services" tab and see if the checkbox is checked. If it is, uncheck it, and the XML you're seeing should disappear from your app.config file.

IMPORTANT! - It seems there is a bug in VS2010 (and possibly other versions for all I know) where if you navigate to the "Services" tab, it will automatically check this box for you, adding the errant XML to your app.config file. So once you unckeck the box and save your project, navigate to a different tab in the properties section before closing it. You will also get an unnecessary reference to "System.Web.Extensions" added to your project. If you aren't using this for something else, you can remove it.

like image 166
Zach Avatar answered Nov 13 '22 22:11

Zach


it is used by ClientFormsAuthenticationMembershipProvider.

You can remove it if you do not use that model but it should be there if you use it even if it is empty.

Check my answer here - ASP.NET Membership Authentication through Service

like image 35
Dmitry Harnitski Avatar answered Nov 13 '22 23:11

Dmitry Harnitski


Is the setting referenced anywhere in your code?

If not, you can probably remove it. If it is, only you can determine what the impact of removing it may be.

Please note that this could be used be a third party assembly and it may still look for it and throw an exception if it does not exist. This would be simple to spot (your application will fall over)

like image 2
ChrisBint Avatar answered Nov 13 '22 23:11

ChrisBint