Issues with 2019 install and Invoke-WebRequest

This forum can be browsed by the general public. Posting is limited to current SAPIEN license holders with active maintenance and does not offer a response time guarantee.
Forum rules
DO NOT POST LICENSE NUMBERS, ACTIVATION KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 5 years and 3 weeks old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
User avatar
CodSup01
Posts: 9
Last visit: Mon Feb 13, 2023 1:44 am

Re: Issues with 2019 install and Invoke-WebRequest

Post by CodSup01 »

Hi David,

I appear to have this working now, the scriptdriver64.exe.config looks like this:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
   <startup useLegacyV2RuntimeActivationPolicy="true">
      <supportedRuntime version="v4.0" />
      <supportedRuntime version="v2.0" />
      <section name="uri" type="System.Configuration.UriSection, System,                           Version=4.0.0.0, Culture=neutral,                           PublicKeyToken=b77a5c561934e089" />
      <uri>
         <schemeSettings>
            <add name="http|https" genericUriParserOptions="DontUnescapePathDotsAndSlashes" />
         </schemeSettings>
      </uri>
   </startup>
</configuration>
User avatar
davidc
Posts: 5913
Last visit: Mon Jul 08, 2019 8:55 am
Been upvoted: 2 times

Re: Issues with 2019 install and Invoke-WebRequest

Post by davidc »

The Uri section is valid. In addition, PowerShell.exe's config file has the same section. The only difference is that our config file has the startup element:

Code: Select all

<startup useLegacyV2RuntimeActivationPolicy="true"> 
        <supportedRuntime version="v4.0" />    
	    <supportedRuntime version="v2.0" />
</startup>
1. Does the error still occur if you remove this section?
2. If item 1 works, try inserting the startup element after the uri element.
David
SAPIEN Technologies, Inc.
User avatar
CodSup01
Posts: 9
Last visit: Mon Feb 13, 2023 1:44 am

Re: Issues with 2019 install and Invoke-WebRequest

Post by CodSup01 »

Hi David,

The issue still occurs after removing the startup config.
User avatar
davidc
Posts: 5913
Last visit: Mon Jul 08, 2019 8:55 am
Been upvoted: 2 times

Re: Issues with 2019 install and Invoke-WebRequest

Post by davidc »

We are updating the ScriptDriver config file as follows:

Code: Select all

<?xml version="1.0" encoding="utf-8" ?> 
<configuration> 
    <startup useLegacyV2RuntimeActivationPolicy="true"> 
        <supportedRuntime version="v4.0" />    
	    <supportedRuntime version="v2.0" />
    </startup>
	<configSections> 
		<section name="uri" type="System.Configuration.UriSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/> 
	</configSections> 
	<uri>
		<schemeSettings>
			<add name="http" genericUriParserOptions="DontUnescapePathDotsAndSlashes"/>
			<add name="https" genericUriParserOptions="DontUnescapePathDotsAndSlashes"/>
		</schemeSettings>
	</uri>
</configuration>
Please verify that this works for you.
David
SAPIEN Technologies, Inc.
User avatar
CodSup01
Posts: 9
Last visit: Mon Feb 13, 2023 1:44 am

Re: Issues with 2019 install and Invoke-WebRequest

Post by CodSup01 »

Hi David,

Now receiving the following error:

Only one <configSections> element allowed per config file and if present must be the first child of the root <configuration> element. (C:\Program Files\SAPIEN Technologies, Inc\PowerShell Studio 2019\Debugger64\scriptdriver64.exe.Config line 7)
User avatar
davidc
Posts: 5913
Last visit: Mon Jul 08, 2019 8:55 am
Been upvoted: 2 times

Re: Issues with 2019 install and Invoke-WebRequest

Post by davidc »

Looks like the configSections element has to be at the top. Try this:

Code: Select all

<?xml version="1.0" encoding="utf-8" ?> 
<configuration> 
	<configSections> 
		<section name="uri" type="System.Configuration.UriSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/> 
	</configSections> 
    <startup useLegacyV2RuntimeActivationPolicy="true"> 
        <supportedRuntime version="v4.0" />    
	    <supportedRuntime version="v2.0" />
    </startup>
	<uri>
		<schemeSettings>
			<add name="http" genericUriParserOptions="DontUnescapePathDotsAndSlashes"/>
			<add name="https" genericUriParserOptions="DontUnescapePathDotsAndSlashes"/>
		</schemeSettings>
	</uri>
</configuration>
David
SAPIEN Technologies, Inc.
User avatar
CodSup01
Posts: 9
Last visit: Mon Feb 13, 2023 1:44 am

Re: Issues with 2019 install and Invoke-WebRequest

Post by CodSup01 »

Hi David,

That did the trick, thanks for all your help.
User avatar
davidc
Posts: 5913
Last visit: Mon Jul 08, 2019 8:55 am
Been upvoted: 2 times

Re: Issues with 2019 install and Invoke-WebRequest

Post by davidc »

I'm glad to hear it and thank you for the update. We will include the new config in the next service release.
David
SAPIEN Technologies, Inc.
User avatar
davidc
Posts: 5913
Last visit: Mon Jul 08, 2019 8:55 am
Been upvoted: 2 times

Re: Issues with 2019 install and Invoke-WebRequest

Post by davidc »

We release a new service build of PowerShell Studio (v5.6.160) with the updated config file.
David
SAPIEN Technologies, Inc.
This topic is 5 years and 3 weeks old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.