Refreshing service references updates the app.config

旧时模样 提交于 2019-12-04 01:46:50

问题


Every time I make changes to my WS and update the reference in Visual Studio, VS overwrites my app.config with additional unnecessary information. So when I start my client afterwards, I get this error:

An error was discovered processing the header

The changes that the code generator made was to remove this line from every binding (note I'm using customBinding/httpsTransport):

<security authenticationMode="UserNameOverTransport" includeTimestamp="false">
    <secureConversationBootstrap/>
</security>

Then I have to close the client, revert the app.config changes and restart the client which is a hassle.

I would prefer if the app.config would be left alone.

Are you experiencing the same problem and do you have a workaround?


回答1:


Stop changing your WS!?! :P

Seriously though, since you are updating your WS and then updating the reference it is going to update the app.config / web.config. The reason is because there is a section under applicationSettings that reference the WS.

EX:

 <applicationSettings>
    <RemoteAssessment.CatCall.My.MySettings>
        <setting name="RemoteAssessment_CatCall_CATService01_CATService"
            serializeAs="String">
            <value>URLTOSERVICE/catservice.asmx</value>
        </setting>
    </RemoteAssessment.CatCall.My.MySettings>
</applicationSettings>

Sadly, I do not think there is a way to stop VS from updating the app.config. I could be wrong though.




回答2:


Ended up doing this programmatically which solved the problem.



来源:https://stackoverflow.com/questions/4625743/refreshing-service-references-updates-the-app-config

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!