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 ?
"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
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....