开发者

WCF Service Reference issue on production in console application

I have 1 c# Console Application project, which has Program.cs (that contains main method), the main method simple calls a web service method and displays the string on the console.

The service reference is added in the project by right clicking it and adding service reference it to it.

  • when the console application is executed in debug mode from visual studio, it works as expected.

  • when the console application is executed from a .exe found in /bin/debug, it works as expected.

so far so good.

PROBLEM:

when the project is copied over to the system (you can call it a production environment), where this .exe will actually be executed, it fails at the exact line where i create the serv开发者_Python百科ice proxy object. the line in Program.cs is:

ProjectName.ServiceReference.ServiceClient service = new ProjectName.ServiceReference.ServiceClient();

I know it fails here, because i have Console.Writeline("some line"); before and after the above line. I can see the Console.Writeline that is before the proxy line, and soon after that it crashes ...

I think this is because the reference paths that are referencing the service, is there any thing i can do to change the paths, or confirm that it is the path issue as suspected ...??

any idea whats going wrong ..???


Check this link: http://blog.davidsandor.com/post/Workaround-The-configuration-for-the-servicee280a6Unrecognized-element-e28098extendedProtectionPolicye28099.aspx

The configuration for the service reference could not be updated due to the following issue: Unrecognized element ‘extendedProtectionPolicy’. (App.config / Web.config)

There does not seem to be a really clear reason why this is happening however it seems to be related to Windows 7. I am not sure if the .NET framework that ships with Win7 has some different setting or template for the WCF configuration policy files but it seems to be the culprit. Maybe the machine.config files are different on Win 7 and the WCF configuration tools use the machine.config as some sort of policy template.

The fix is annoying (because every time you build your solution on Windows 7 and then rebuild on Vista you have to redo this).

Remove the line:

<extendedProtectionPolicy policyEnforcement="Never" />

from both your App/Web.config file on the client and on the WCF server’s Web.config file.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜