Connecting my local server (created with xampp) with SQL Server in VS code, how is it possible?
{
"mssql.connections": [
{
"server": "localhost",
"database": "Haani",
"user": "sa",
"password": "",
"authenticationType": "SqlLogin",
"emptyPasswordInput": true,
"savePassword": true
}
]
}
Related
I'm trying to write tests to see if a service is OK, Unknown, or Unreachable via my API. However, all of my tests come back as having passed. I know that all my servers are in an "OK" state, though, and that none of them are "Unreachable" or "Unknown." I believe the "unknown" and "unreachable" tests should be failing. What am I doing wrong?
Here's the body of the response:
{
"result": {
"dhcpServers": [
{
"ref": "DHCPServers/4",
"name": "unixdns",
"address": "10.9.0.220",
"resolvedAddress": "10.9.0.220",
"username": "",
"password": "",
"type": "ISC",
"state": "OK",
"security": "Unknown",
"customProperties": {},
"enabled": true,
"dhcpv6": false
},
{
"ref": "DHCPServers/15",
"name": "mmappliance",
"address": "10.9.0.156",
"resolvedAddress": "10.9.0.156",
"username": "",
"password": "",
"type": "ISC",
"state": "OK",
"security": "Unknown",
"customProperties": {},
"enabled": true,
"dhcpv6": false
},
{
"ref": "DHCPServers/19",
"name": "WIN-51",
"proxy": "10.9.0.150",
"address": "10.9.0.150",
"resolvedAddress": "10.9.0.150",
"username": "",
"password": "",
"type": "MSDHCP",
"state": "OK",
"security": "Unknown",
"customProperties": {},
"enabled": true,
"dhcpv6": true
},
{
"ref": "DHCPServers/22",
"name": "WIN-PM",
"proxy": "10.9.0.100",
"address": "10.9.0.100",
"resolvedAddress": "10.9.0.100",
"username": "",
"password": "",
"type": "MSDHCP",
"state": "OK",
"security": "Unknown",
"customProperties": {},
"enabled": true,
"dhcpv6": true
}
],
"totalResults": 4
}
}
I've written the following tests:
let jsonData = pm.response.json()
pm.test('DHCP service is ok', () => {
_.each(jsonData.dhcpServers, (item) => {
pm.expect(item.state).to.have.body('OK')
})
})
pm.test('DHCP service is Unknown', () => {
_.each(jsonData.dhcpServers, (item) => {
pm.expect(item.state).to.have.body('Unknown')
})
})
pm.test('DHCP service is unreachable', () => {
_.each(jsonData.dhcpServers, (item) => {
pm.expect(item.state).to.have.body('Unreachable')
})
})
//Unknown - DHCP Server Controller status is unknown.
//OK - DHCP Server Controller and service are both OK.
//Unreachable - DHCP Server Controller is offline or otherwise unreachable.
//Out of date - DHCP Server Controller has a different version than Central.
//Updating - DHCP Server Controller version is being updated.
//Uninitialized - DHCP Server is on a uninitialized appliance that needs to be manually initialized.
//Detached - DHCP Server has been detached without removing it from the system.
//DHCP Service Down - DHCP Server service is down and DNS server is not responding to queries.
//DHCP Service Impaired - DHCP Server service is running but impaired.
You miss one level to get dhcpServers. It should be jsonData.result.dhcpServers, not jsonData.dhcpServers,
Use .eql('OK') instead of .to.have.body('OK')
The test would be:
pm.test('DHCP service is ok', () => {
_.each(jsonData.result.dhcpServers, (item) => {
pm.expect(item.state).eql('OK');
})
})
I'm using the SQL Server Serilog sink and using different appsettings.<EVN>.json configuration files (one for the default which is appsettings.json and one for the specific environment I am running in which is currently appsettings.test.json). appsettings.json specifies a SQL Server localhost in the connection string and the appsettings.test.json file specifies a different SQL server for the connection string. When running under any environment other than DEVELOPMENT, Serilog will create a LOG table in both the localdb and whatever environment I am testing (TEST_MSSQL in this case). My assumption is that there would only be one log configured and that the server setting in the appsettings.test.json (External SQL Server) would override the value in the default appsettings.json (Local SQL Server), but it appears to be creating configuring in both the localhost and test SQL Servers.
WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>()
.UseSerilog((context, config) => config.ReadFrom.Configuration(Configuration))
.Build()
.Run();
Settings in default appsettings.json
"Serilog": {
"Using": [ "Serilog.Sinks.MSSqlServer" ],
"MinimumLevel": {
"Default": "Information",
"Override": {
"Microsoft": "Warning",
"System": "Error"
}
},
"WriteTo": [
{
"Name": "Console"
},
{
"Name": "MSSqlServer",
"Args": {
"connectionString": "Data Source=(localdb)\\MSSQLLocalDB;Initial Catalog=MyDB;Integrated Security=True;Connect Timeout=30;",
"schemaName": "dbo",
"tableName": "Log",
"autoCreateSqlTable": true,
"restrictedToMinimumLevel": "Warning",
"batchPostingLimit": 1000,
"period": "0.00:00:30",
"columnOptionsSection": {
"addStandardColumns": [ "LogEvent" ],
"removeStandardColumns": [ "MessageTemplate", "Properties" ],
"logEvent": {
"excludeAdditionalProperties": true,
"excludeStandardColumns": true
}
}
}
}
]
}
Settings in appsettings.test.json
"Serilog": {
"WriteTo": [
{
"Args": {
"connectionString": "Data Source=TEST_MSSQL;Initial Catalog=MyDB;Integrated Security=True;Connect Timeout=30;"
}
}
]
}
When running under any environment other than DEVELOPMENT, Serilog will create a LOG table in both the localdb and whatever environment I am testing (TEST_MSSQL in this case).
I can reproduce same issue based on the configuration data you provided.
To override default connectionString for Serilog you specified in appsettings.json file and fix above issue, you can update your appsettings.test.json file like below.
{
"Serilog": {
"WriteTo": [
{
"Name": "Console"
},
{
"Name": "MSSqlServer",
"Args": {
"connectionString": "Data Source=TEST_MSSQL;Initial Catalog=MyDB;Integrated Security=True;Connect Timeout=30;",
}
}
]
}
}
I have a docker container running Swagger UI on port 80 and I have another API running in another container on port 32788
http://127.0.0.1:80/ >>> returns swagger UI
http://127.0.0.1:32788/swagger.json >>> returns swagger API def
But when I put the json file into the Swagger UI field and hit explore, it says
NetworkError when attempting to fetch resource. http://127.0.0.1:32788/swagger.json
Any ideas on how to solve this. The docs say that they should automatically be connected to the bridge network.
Below is the result of the network inspection
docker network inspect bridge
[
{
"Name": "bridge",
"Id": "4b5cc1526055297df70dc9adc4959fcee93384c412fbf90500c041b5b83ed43a",
"Created": "2018-01-17T03:48:39.2325461Z",
"Scope": "local",
"Driver": "bridge",
"EnableIPv6": false,
"IPAM": {
"Driver": "default",
"Options": null,
"Config": [
{
"Subnet": "172.17.0.0/16",
"Gateway": "172.17.0.1"
}
]
},
"Internal": false,
"Attachable": false,
"Ingress": false,
"ConfigFrom": {
"Network": ""
},
"ConfigOnly": false,
"Containers": {
"257a15af9ab9b25c6c5622fb0ebe599e5703b2ca5f2e4eaa97a8745a21e7f9a9": {
"Name": "pensive_neumann",
"EndpointID": "22be4b781f75e071bcb0098b917b81b16ca493e9080848188dd7a811c27070ec",
"MacAddress": "02:42:ac:11:00:02",
"IPv4Address": "172.17.0.2/16",
"IPv6Address": ""
},
"30de904a599a19075d5e20ef5d974a11be9d7e58a68d984a24f4af9e22c4d92b": {
"Name": "naughty_mirzakhani",
"EndpointID": "f704b3e103a82ca5c56d5955ac27845d8951cfe13f0bc3e1ccc8717ea9c28d39",
"MacAddress": "02:42:ac:11:00:03",
"IPv4Address": "172.17.0.3/16",
"IPv6Address": ""
}
},
"Options": {
"com.docker.network.bridge.default_bridge": "true",
"com.docker.network.bridge.enable_icc": "true",
"com.docker.network.bridge.enable_ip_masquerade": "true",
"com.docker.network.bridge.host_binding_ipv4": "0.0.0.0",
"com.docker.network.bridge.name": "docker0",
"com.docker.network.driver.mtu": "1500"
},
"Labels": {}
}
]
Edit to explain how started each:
The API is part of Azure Machine Learning so its hard to say how it gets started exactly (unless there is some command I can run in docker):
az ml service create realtime
Swagger UI was started as follows:
docker run -p 80:8080 swaggerapi/swagger-ui
i have a problem with remote connections.
my vhost is : redis.test
i added this on blade file:
<script src="//redis.test:6001/socket.io/socket.io.js"></script>
.env file
BROADCAST_DRIVER=redis
REDIS_HOST=redis.test
REDIS_PASSWORD=null
REDIS_PORT=6379
echo configuration
import Echo from "laravel-echo"
window.Echo = new Echo({
broadcaster: 'socket.io',
host: 'http://redis.test:6001'
});
laravel-exho-server.json
{
"authHost": "http://redis.test",
"authEndpoint": "/broadcasting/auth",
"clients": [
{
"appId": "f27485125ac2627f",
"key": "6328e672f42cbf4cba1de3da215ec41a"
}
],
"database": "redis",
"databaseConfig": {
"redis": {
"port": "6379",
"host": "redis.test"
},
"sqlite": {
"databasePath": "/database/laravel-echo-server.sqlite"
}
},
"devMode": true,
"host": "redis.test",
"port": "6001",
"protocol": "http",
"socketio": {},
"sslCertPath": "",
"sslKeyPath": ""
}
it works when i try to broadcast with a local connection (2 browsers - same pc), but when i try to send a "message" from other pc on lan network (192.168.1.50) i have this error
GET: http://redis.test:6001/socket.io/socket.io.js net::err_connection_refused
[vue_warn] error in created hook
how ca i resolve this?
It may be a firewall issue as I can see, try to open redis port in the firewall
my mup.json config for first meteor instance:
{
"servers": [
{
"host": "111.222.333.444",
"username": "root",
"password": "mypass"
}
],
"setupMongo": true,
"setupNode": true,
"nodeVersion": "0.10.40",
"setupPhantom": false,
"enableUploadProgressBar": true,
"appName": "myapp1",
"app": "../myapp1",
"env": {
"PORT": 3001,
"ROOT_URL": "https://my.domain.com"
},
"ssl": {
"pem": "./ssl.pem"
},
"deployCheckWaitTime": 15
}
So after deployment I want to get access to this instance by https://my.domain.com:3001. Then with similar configuration I want to deploy second instance to same droplet and get access to it by https://my.domain.com:3002.
The problem is that after deployment accessing by https taking ERR_CONNECTION_CLOSED, but accessing by http is OK.
How can I make it working?
Finally, I did it.
Firstly, I used mupx. But there I had troubles too. Later I found that my fault was writing same ports for different apps or protocols. So, there is working configurations of first and second apps:
{
"servers": [{
"host": "111.222.333.444",
"username": "root",
"password": "mypass",
"env": {}
}],
"setupMongo": true,
"appName": "myapp1",
"app": "../myapp1",
"env": {
"PORT": 8000,
"ROOT_URL": "http://my.domain.com"
},
"deployCheckWaitTime": 15,
"enableUploadProgressBar": true,
"ssl": {
"certificate": "../ssl/bundle.crt",
"key": "../ssl/private.key",
"port": 8001
}
}
{
"servers": [{
"host": "111.222.333.444",
"username": "root",
"password": "mypass",
"env": {}
}],
"setupMongo": true,
"appName": "myapp2",
"app": "../myapp2",
"env": {
"PORT": 8100,
"ROOT_URL": "http://my.domain.com"
},
"deployCheckWaitTime": 15,
"enableUploadProgressBar": true,
"ssl": {
"certificate": "../ssl/bundle.crt",
"key": "../ssl/private.key",
"port": 8101
}
}
bundle.crt and private.key are common for all apps.
Don't forget to use mupx.
So after
mupx setup
mupx deploy
We can get access for first app by
http://my.domain.com:8000
https://my.domain.com:8001
And for second app by
http://my.domain.com:8100
https://my.domain.com:8101
EDIT: accessing by http is not working. I don't know why, maybe it just for my configuration. But this feature I don't need, I need only https. So if you know how to fix, please, write.
EDIT2: it's alright, http access works. The reason was Chrome browser, it always redirects my domain from http to https. After cleaning browser history it do all good.