1. Sivaprakash BKR
  2. SnapDevelop
  3. Friday, 23 April 2021 08:23 AM UTC

Hello,

PB 2019R3, SnapDevelop 2019 R3

Installed Powerbuilder 2019R3 without first installing IIS in a Windows 10 machine.  Now trying to run 

https://github.com/Appeon/.NET-DataStore-Example
https://github.com/Appeon/PowerBuilder-RestClient-Example

I get an error 'Failed to load the json file'.   After this error, I enabled (installed) IIS in my machine.  What else should I do to run this example?

1.  Should I publish snapdevelop application to my local server?
2.  Should I re-install snapdevelop, that IIS will be configured correctly ?  

Any documentation ?

Happiness Always
BKR Sivaprakash

 

Logan Liu @Appeon Accepted Answer Pending Moderation
  1. Tuesday, 27 April 2021 08:33 AM UTC
  2. SnapDevelop
  3. # 1

Hi BKR,

Your appsettings.json is not using the correct JSON format. 

 

Solution 1:
"AdventureWorks": "Data Source=EliteJava\SQL2012;Initial Catalog=AdventureWorks2012;Integrated Security=False;User ID=sa;Password=pass;Pooling=False;Min Pool Size=0;Max Pool Size=100;ApplicationIntent=ReadWrite"

Please modify it to EliteJava\\SQL2012 and try again.

 

Solution 2:

Open SnapDevelop, right-click your project -> Add -> New Item -> DataContext, the wizard can also help you to generate the correct connection string and add it into your appsettings.json file.

 

If you want to know more details about JSON, please refer to https://tools.ietf.org/html/rfc7159

"The representation of strings is similar to conventions used in the C
family of programming languages. A string begins and ends with quotation marks. All Unicode characters may be placed within the
quotation marks, except for the characters that must be escaped:
quotation mark, reverse solidus, and the control characters (U+0000
through U+001F)."

Regards,

Logan

Comment
  1. Sivaprakash BKR
  2. Wednesday, 28 April 2021 05:10 AM UTC
Thanks Logan,

As suggested, snapdevelopa application works after modifying data source to EliteJava\\SQL2012 in appsettings.json. But the issue remains while connecting the database from DB Server Explorer. Same change (EliteJava\\SQLServer2012) is not working. Any suggestion ?
  1. Helpful
  1. Logan Liu @Appeon
  2. Wednesday, 28 April 2021 05:52 AM UTC
While connecting the database from DB Server Explorer with its wizard, not editing appsettings.json dirrectly, you should also use EliteJava\SQLServer2012 as the HOST. If still not resolved, Please shows more details about your DB Server Explorer issue.

Regards, Logan
  1. Helpful
There are no comments made yet.
Sivaprakash BKR Accepted Answer Pending Moderation
  1. Monday, 26 April 2021 11:47 AM UTC
  2. SnapDevelop
  3. # 2

Thanks Logan


Here is my appsettings.json

****************************
{
"Logging": {
"LogLevel": {
"Default": "Warning"
}
},
"AllowedHosts": "*",
"ConnectionStrings": {
//"AdventureWorks": "Host=192.168.1.21;Database=AdventureWorks;Port=5433;Username=postgres;Password=pass;TCP Keepalive Time=0;Keepalive=0;Command Timeout=30;TCP Keepalive Interval=0;Timeout=15;Connection Pruning Interval=10;Connection Idle Lifetime=300;Maximum Pool Size=100;Minimum Pool Size=0;Internal Command Timeout=-1;Read Buffer Size=8192;Socket Receive Buffer Size=8192;Pooling=True;Socket Send Buffer Size=8192;Max Auto Prepare=0;Auto Prepare Min Usages=5;Use Perf Counters=False;No Reset On Close=False;Convert Infinity DateTime=False;Write Buffer Size=8192;Persist Security Info=False;Include Realm=False;Enlist=False;Integrated Security=False;Encoding=UTF8;Trust Server Certificate=False;Check Certificate Revocation=False;SSL Mode=Disable"


"AdventureWorks": "Data Source=EliteJava\SQL2012;Initial Catalog=AdventureWorks2012;Integrated Security=False;User ID=sa;Password=pass;Pooling=False;Min Pool Size=0;Max Pool Size=100;ApplicationIntent=ReadWrite"
}
}

***********************

First connection [commented] to connect Postgres, which get connected.
Second one [ non-commented] to connect SQLServer, which gives me error

The message which I get while running Test of SampleController.cs is
Failed to start the Web API Tester. Please check the output error message.

The following is the error message
**************************************************

Web API Tester->The test service has started and is listening on port 65533.
Host-> Host failed to start: System.FormatException: Could not parse the JSON file.
Host->  ---> System.Text.Json.JsonReaderException: 'S' is an invalid escapable character within a JSON string. The string should be correctly escaped. LineNumber: 9 | BytePositionInLine: 45.
Host->    at System.Text.Json.ThrowHelper.ThrowJsonReaderException(Utf8JsonReader& json, ExceptionResource resource, Byte nextByte, ReadOnlySpan`1 bytes)
Host->    at System.Text.Json.Utf8JsonReader.ConsumeStringAndValidate(ReadOnlySpan`1 data, Int32 idx)
Host->    at System.Text.Json.Utf8JsonReader.ConsumeString()
Host->    at System.Text.Json.Utf8JsonReader.ConsumeValue(Byte marker)
Host->    at System.Text.Json.Utf8JsonReader.ReadSingleSegment()
Host->    at System.Text.Json.Utf8JsonReader.Read()
Host->    at System.Text.Json.JsonDocument.Parse(ReadOnlySpan`1 utf8JsonSpan, Utf8JsonReader reader, MetadataDb& database, StackRowStack& stack)
Host->    at System.Text.Json.JsonDocument.Parse(ReadOnlyMemory`1 utf8Json, JsonReaderOptions readerOptions, Byte[] extraRentedBytes)
Host->    at System.Text.Json.JsonDocument.Parse(ReadOnlyMemory`1 json, JsonDocumentOptions options)
Host->    at System.Text.Json.JsonDocument.Parse(String json, JsonDocumentOptions options)
Host->    at Microsoft.Extensions.Configuration.Json.JsonConfigurationFileParser.ParseStream(Stream input)
Host->    at Microsoft.Extensions.Configuration.Json.JsonConfigurationProvider.Load(Stream stream)
Host->    --- End of inner exception stack trace ---
Host->    at Microsoft.Extensions.Configuration.Json.JsonConfigurationProvider.Load(Stream stream)
Host->    at Microsoft.Extensions.Configuration.FileConfigurationProvider.Load(Boolean reload)
Host-> --- End of stack trace from previous location where exception was thrown ---
Host->    at Microsoft.Extensions.Configuration.FileConfigurationProvider.HandleException(ExceptionDispatchInfo info)
Host->    at Microsoft.Extensions.Configuration.FileConfigurationProvider.Load(Boolean reload)
Host->    at Microsoft.Extensions.Configuration.FileConfigurationProvider.Load()
Host->    at Microsoft.Extensions.Configuration.ConfigurationRoot..ctor(IList`1 providers)
Host->    at Microsoft.Extensions.Configuration.ConfigurationBuilder.Build()
Host->    at Microsoft.Extensions.Hosting.HostBuilder.BuildAppConfiguration()
Host->    at Microsoft.Extensions.Hosting.HostBuilder.Build()
Host->    at SnapDevelop.WebApiTester.Host.TargetFrameworkHost_3x.Initialize(String[] args)
Host->    at SnapDevelop.WebApiTester.Host.WebApiTesterHost..ctor(String[] args)
Host->    at SnapDevelop.WebApiTester.Host.Program.Main(String[] args)
Host-> 
The process has exited.
Host->Web API Tester stop.

************************************************

Any idea ?

 

Comment
There are no comments made yet.
Logan Liu @Appeon Accepted Answer Pending Moderation
  1. Sunday, 25 April 2021 02:58 AM UTC
  2. SnapDevelop
  3. # 3

Hi BKR,

1) Have you modified the appsettings.json file?

Please refer to the README.md in https://github.com/Appeon/.NET-DataStore-Example:

In the Solution Explorer, open the file appsettings.json, and modify the Data Source, Initial Catalog, User ID, and Password in the connection string based on your environment. Note that the value of the Initial Catalog must be the same as the name of the database (AdventureWorks2012 by default) you restored in the SQL Server.

2) You can also verify a Web API by Web API Tester to check if you can get the correct response from any action. For how to use the Web API Tester, please refer to:

https://docs.appeon.com/snapdevelop2019r3/Testing_with_Web_API_Tester/index.html

Regards,

Logan

Comment
  1. Sivaprakash BKR
  2. Monday, 26 April 2021 04:56 AM UTC
As Chris said, trying to find out which driver is used to connect SQL Server from snapdevelop application. What I could see is 32 bit driver only for SQL Server.
  1. Helpful
  1. Logan Liu @Appeon
  2. Monday, 26 April 2021 06:45 AM UTC
Hi BKR,

"Could not get the correct response from WebAPI Tester."

Could you show the response body?



You don't need to install any SQL Server driver to connect SQL Server from SnapDevelop. Please try to connect your database from View - DB Server Explorer - Connect to the database to verify it.



There is also a related question:

https://community.appeon.com/index.php/qna/q-a/trouble-connecting-to-adventureworks2012-database-in-snapdevelop



Regards,

Logan
  1. Helpful
  1. Sivaprakash BKR
  2. Tuesday, 27 April 2021 08:19 AM UTC
Thanks Chris and Logan

From DB Explorer of Snapdevelop also, I could not connect to SQL Server. Works fine when connecting to Postgres.

I get the following error, when connecting to SQL Server

A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: TCP Provider, error: 0 - The remote computer refused the network connection.)



The remote computer refused the network connection.



*********************

I could connect to the same SQL Server instance from PB 2019 R3. PB, SnapDevelop, SQL Server all are in the same computer. TCP is enabled in SQL Server. Instance name is correct [ComputerName\InstanceName], it's a express edition. Login id and password are correct [SQL Server Authentication]. SQL Brower is running. Remote connection is enabled.



Still something is evading....

  1. Helpful
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Friday, 23 April 2021 15:11 PM UTC
  2. SnapDevelop
  3. # 4

Hi BKR;

  Yes, please do steps #2 and #1 in that order

   To get the PowerClient pieces installed under IIS, you need to create and upload the "Cloud App Launcher" from the PB IDE's "PowerClient" project or via the PB IDE's "Tools" menu to IIS. Once that is done, you should be able to deploy & run R3 based PowerClient Apps.

  Since you now have IIS installed, SNAP Develop should now be installable and usable for C# Web API web service creation and publication to your IIS server.

Regards ... Chris

Comment
There are no comments made yet.
Sivaprakash BKR Accepted Answer Pending Moderation
  1. Friday, 23 April 2021 13:23 PM UTC
  2. SnapDevelop
  3. # 5

Hello,

Looks like the error is not able to connect to SQL Server from Snap Develop.   The same SQL Server could be connected from Powerbuilder (in the same machine and from other machines).  

What could be the possibility for not connecting to SQL Server from snap develop ?

Happiness Always
BKR Sivaprakash

 

Comment
  1. Chris Pollach @Appeon
  2. Friday, 23 April 2021 15:22 PM UTC
Hi BKR;

SS is supported by SNAP however, you must install the SS 64 bit DB Client for SNAP's SS access. PB on the other hand, requires 32bit SS DB Client. So both SS DB Client's are required. Hopefully, that's your missing piece to the puzzle.

Regards ... Chris
  1. Helpful
  1. Sivaprakash BKR
  2. Saturday, 24 April 2021 01:57 AM UTC
Thanks Chris,

Would like to know which driver is used to connect SQL Server (SQL Native, OLE DB, ODBC ...) ? How / Where to find this information within Snapdevelop ?

  1. Helpful
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.
We use cookies which are necessary for the proper functioning of our websites. We also use cookies to analyze our traffic, improve your experience and provide social media features. If you continue to use this site, you consent to our use of cookies.