I've added a new Settings.settings file to my ASP.NET Webclient project; I am having a problem encrypting the section. In the cmd window positioned to this directory:

C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319>

Here is my syntax:

aspnet_regiis -pe "Webclient.Properties.Settings" -app "/sdkTrimFileServiceASMXclient"

Output:

Encrypting configuration section...
The configuration section 'Webclient.Properties.Settings' was not found.
Failed!

My project is called Webclient; I clicked on the Settings tab and added 2 elements. Visual Studio 2010 added the Settings.settings file and updated my web.config as follows:

  <configSections>
    <sectionGroup name="applicationSettings" 
            type="System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">

        <section name="WebClient.Properties.Settings" 
            type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" 
            requirePermission="false" />
        <section name="FileServiceProxy.Properties.Settings" 
            type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" 
            requirePermission="false"/>
    </sectionGroup>
  </configSections>

  <applicationSettings>
      <WebClient.Properties.Settings>
          <setting name="GROUPERpassword" serializeAs="String">
              <value>12345abcde</value>
          </setting>
          <setting name="MARLINpassword" serializeAs="String">
              <value>abcdef12345</value>
          </setting>
      </WebClient.Properties.Settings>

      <FileServiceProxy.Properties.Settings>
          <setting name="FileServiceProxy_ASMXproxy_FileService" serializeAs="String">
              <value>http://MDWDATA/sdkTrimFileServiceASMX/FileService.asmx</value>
          </setting>
      </FileServiceProxy.Properties.Settings>

  </applicationSettings>

I have also tried this syntax (i.e. just "Webclient" rather than "Webclient.Properties.Settings") and I get the same failure as above.

aspnet_regiis -pe "Webclient" -app "/sdkTrimFileServiceASMXclient"

In the Default Web Site on my IIS 6.0 Windows 2003 Server machine, I have a virtual directory called: sdkTrimFileServiceASMXclient

The local path to the physical directory: C:\ProjectsVS2010\sdkTrimFileServiceASMX\WebClient

I can't figure out what I'm doing wrong here.

------------------------------ EDIT UPDATE --------------------------- 13 Dec 2011 A suggestion was made to try this syntax (but I got the same error):

C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319>aspnet_regiis -pe "applicationSettings/Webclient" -app "/sdkTrimFileServiceASMXclient"

Encrypting configuration section...
The configuration section 'applicationSettings/Webclient' was not found.
Failed!
有帮助吗?

解决方案

Try "applicationSettings/WebClient" instead of just "WebClient" in your script.

This command is case sensitive, as @John Adams said in his comment below.

其他提示

By @John Adams

"On a different forum, someone pointed out that the real problem was the fact that the XML is case-sensitive and that in the command, I needed to specify 'applicationSettings/WebClient' instead of 'applicationSettings/Webclient'. The latter was, of course, not found in the web.config with that spelling. Finally, case closed. NOTE to someone who can EDIT the answer: improve the answer to reflect this comment added by me. Thanks"

It is not an optimal solution, but changing the name of a file to web.config should do the job.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top