This always means you’re somehow activating the x86 code from an x64 process, or activating the x64 code from an x86 process. Are you running with “Any CPU”? I think I might have experienced this issue when running in my visual studio debugger but it only happened one time. You don’t have the project online at all for me to look at and try do you? I also notice that this is with the older code base. Do you need to use the older code? The newest library was updated with all the linux+mac binaries and should have this problem sorted.
Can you uncomment the native debugging lines to get the native logs:
//API.NativeLogger = API.DefaultConsoleLoggerFunction;
//API.InitializeZiti(OpenZiti.Logging.ZitiLogLevel.DEBUG);
That will output extra logging from the native debugger to your console for view. There might be some useful information in there. My guess is that the service is somehow setup incorrectly or that a router is offline. Get the DEBUG logs and let me look at that please?
Used the express install to create a local network. Here are controller, edge-router and application logs:
Controller logs:
[76013.332] ERROR channel/v2.(*classicListener).acceptConnection.func1 [tls:0.0.0.0:6262]: connection handler error for [tls:127.0.0.1:50896] (unknown/unenrolled router, routerId: q0dI7hhV6C)
[76014.668] ERROR fabric/controller/handler_ctrl.(*ConnectHandler).HandleConnection: {routerId=[OFQ2-ZurM]} unknown/unenrolled router
[76014.668] ERROR channel/v2.(*classicListener).acceptConnection.func1 [tls:0.0.0.0:6262]: connection handler error for [tls:127.0.0.1:50901] (unknown/unenrolled router, routerId: OFQ2-ZurM)
[76014.775] ERROR fabric/controller/handler_ctrl.(*ConnectHandler).HandleConnection: {routerId=[q0dI7hhV6C]} unknown/unenrolled router
[76014.776] ERROR channel/v2.(*classicListener).acceptConnection.func1 [tls:0.0.0.0:6262]: connection handler error for [tls:127.0.0.1:50902] (unknown/unenrolled router, routerId: q0dI7hhV6C)
Edge-router logs:
[76191.800] INFO channel/v2.getRetryVersionFor: defaulting to version 2
[76191.800] ERROR channel/v2.(*reconnectingDialer).Reconnect [u{reconnecting}->i{l8E6} @tls:ACHITRAPUR-LT:6262]: hello attempt [#14450] failed (EOF)
[76192.442] ERROR channel/v2.(*heartbeater).sendHeartbeat: {error=[timeout waiting for message reply: context deadline exceeded] channelId=[ch{ctrl}->u{reconnecting}->i{l8E6}]} failed to send heartbeat
[76193.443] ERROR channel/v2.(*heartbeater).sendHeartbeat: {error=[timeout waiting for message reply: context deadline exceeded] channelId=[ch{ctrl}->u{reconnecting}->i{l8E6}]} failed to send heartbeat
[76194.443] ERROR channel/v2.(*heartbeater).sendHeartbeat: {error=[timeout waiting for message reply: context deadline exceeded] channelId=[ch{ctrl}->u{reconnecting}->i{l8E6}]} failed to send heartbeat
[76195.445] ERROR channel/v2.(*heartbeater).sendHeartbeat: {error=[timeout waiting for message reply: context deadline exceeded] channelId=[ch{ctrl}->u{reconnecting}->i{l8E6}]} failed to send heartbeat
[76196.447] ERROR channel/v2.(*heartbeater).sendHeartbeat: {error=[timeout waiting for message reply: context deadline exceeded] channelId=[ch{ctrl}->u{reconnecting}->i{l8E6}]} failed to send heartbeat
[76196.823] INFO channel/v2.getRetryVersionFor: defaulting to version 2
[76196.823] ERROR channel/v2.(*reconnectingDialer).Reconnect [u{reconnecting}->i{l8E6} @tls:ACHITRAPUR-LT:6262]: hello attempt [#14451] failed (EOF)
[76197.449] ERROR channel/v2.(*heartbeater).sendHeartbeat: {error=[timeout waiting for message reply: context deadline exceeded] channelId=[ch{ctrl}->u{reconnecting}->i{l8E6}]} failed to send heartbeat
[76198.449] ERROR channel/v2.(*heartbeater).sendHeartbeat: {channelId=[ch{ctrl}->u{reconnecting}->i{l8E6}] error=[timeout waiting for message reply: context deadline exceeded]} failed to send heartbeat
[76199.451] ERROR channel/v2.(*heartbeater).sendHeartbeat: {error=[timeout waiting for message reply: context deadline exceeded] channelId=[ch{ctrl}->u{reconnecting}->i{l8E6}]} failed to send heartbeat
Weather sample logs:
Pasting logs from the enrollement step:
SDKd: ziti-sdk:ziti_enroll.c:163 well_known_certs_cb() CA PEM len = 12643
SDKi: ziti-sdk:ziti_ctrl.c:407 ziti_ctrl_init() ctrl[ACHITRAPUR-LT] ziti controller client initialized
SDKd: ziti-sdk:ziti_ctrl.c:324 ctrl_body_cb() ctrl[ACHITRAPUR-LT] completed POST[/enroll?method=ott&token=70ec2537-6ebb-4de0-8f3f-4740e2519c71] in 0.031 s
SDKd: ziti-sdk:ziti_enroll.c:239 enroll_cb() successfully enrolled with controller https://ACHITRAPUR-LT:1280
Strong identity enrolled successfully. File saved to: C:\Repos\GitHub\Samples\bin\Debug\net6.0/weather.demo.json
SDKd: ziti-sdk:zitilib.c:303 load_ziti_ctx() loading identity from C:\Repos\GitHub\Samples\bin\Debug\net6.0/weather.demo.json
SDKi: ziti_log_set_level set log level: root=4
SDKi: ziti-sdk:ziti.c:428 ziti_init_async() ztx[0] Ziti C SDK version 0.30.8-132 @ecfee7b(HEAD) starting at (2022-12-13T16:50:22.588)
SDKi: ziti-sdk:ziti.c:429 ziti_init_async() ztx[0] using uv_mbed[v0.14.11], tls[mbed TLS 3.2.1]
SDKi: ziti-sdk:ziti.c:430 ziti_init_async() ztx[0] Loading from config[C:\Repos\GitHub\Samples\bin\Debug\net6.0/weather.demo.json] controller[https://ACHITRAPUR-LT:1280]
SDKi: ziti-sdk:ziti_ctrl.c:407 ziti_ctrl_init() ctrl[ACHITRAPUR-LT] ziti controller client initialized
SDKd: ziti-sdk:ziti.c:452 ziti_init_async() ztx[0] using metrics interval: 0
SDKd: ziti-sdk:ziti.c:259 ziti_set_unauthenticated() ztx[0] setting api_session_state[0] to 0
SDKd: ziti-sdk:ziti_ctrl.c:244 ziti_ctrl_clear_api_session() ctrl[ACHITRAPUR-LT] clearing api session token for ziti_controller
SDKd: ziti-sdk:ziti.c:919 ziti_re_auth() ztx[0] re-auth executing, transitioning to unauthenticated
SDKd: ziti-sdk:ziti.c:259 ziti_set_unauthenticated() ztx[0] setting api_session_state[0] to 0
SDKd: ziti-sdk:ziti_ctrl.c:244 ziti_ctrl_clear_api_session() ctrl[ACHITRAPUR-LT] clearing api session token for ziti_controller
SDKd: ziti-sdk:ziti.c:290 is_api_session_expired() ztx[0] is_api_session_expired[TRUE] - api_session is null
SDKi: ziti-sdk:ziti.c:867 ziti_re_auth_with_cb() ztx[0] starting to re-auth with ctlr[https://ACHITRAPUR-LT:1280] api_session_status[0] api_session_expired[TRUE]
SDKd: ziti-sdk:ziti.c:252 ziti_set_auth_started() ztx[0] setting api_session_state[0] to 1
SDKd: ziti-sdk:ziti.c:324 ziti_stop_api_session_refresh() ztx[0] ziti_stop_api_session_refresh: stopping api session refresh
SDKd: ziti-sdk:ziti_ctrl.c:324 ctrl_body_cb() ctrl[ACHITRAPUR-LT] completed GET[/version] in 0.025 s
SDKi: ziti-sdk:ziti.c:1533 version_cb() ztx[0] connected to controller https://ACHITRAPUR-LT:1280 version v0.26.11(807dd591b1f5 2022-11-10T14:53:29Z)
SDKd: ziti-sdk:ziti_ctrl.c:324 ctrl_body_cb() ctrl[ACHITRAPUR-LT] completed POST[/authenticate?method=cert] in 0.043 sSDKd: ziti-sdk:ziti_ctrl.c:257 ctrl_login_cb() ctrl[ACHITRAPUR-LT] authenticated successfully session[clbmgmbe41mbggvs1l202806w]
SDKd: ziti-sdk:ziti.c:1449 api_session_cb() ztx[0] logged in successfully => api_session[clbmgmbe41mbggvs1l202806w]
SDKd: ziti-sdk:ziti.c:1399 ziti_set_api_session() ztx[0] ziti api session expires in 1800 seconds
SDKi: ziti-sdk:ziti.c:1423 ziti_set_api_session() ztx[0] api session set, setting api_session_timer to 1740s
SDKd: ziti-sdk:ziti.c:329 ziti_schedule_api_session_refresh() ztx[0] ziti_schedule_api_session_refresh: scheduling api session refresh: 1740000ms
SDKd: ziti-sdk:ziti.c:284 ziti_set_fully_authenticated() ztx[0] setting api_session_state[1] to 3
SDKd: ziti-sdk:ziti.c:284 ziti_set_fully_authenticated() ztx[0] setting api_session_state[3] to 3
SDKd: ziti-sdk:ziti_ctrl.c:774 ctrl_paging_req() ctrl[ACHITRAPUR-LT] starting paging request GET[/current-identity/edge-routers]
SDKd: ziti-sdk:ziti_ctrl.c:324 ctrl_body_cb() ctrl[ACHITRAPUR-LT] completed GET[/current-identity] in 0.003 s
SDKd: ziti-sdk:ziti_ctrl.c:324 ctrl_body_cb() ctrl[ACHITRAPUR-LT] completed GET[/current-identity] in 0.003 s
SDKd: ziti-sdk:ziti_ctrl.c:324 ctrl_body_cb() ctrl[ACHITRAPUR-LT] completed GET[/current-identity/edge-routers?limit=25&offset=0] in 0.006 s
SDKd: ziti-sdk:ziti_ctrl.c:340 ctrl_body_cb() ctrl[ACHITRAPUR-LT] received 1/1 for paging request GET[/current-identity/edge-routers]
SDKd: ziti-sdk:ziti_ctrl.c:352 ctrl_body_cb() ctrl[ACHITRAPUR-LT] completed paging request GET[/current-identity/edge-routers] in 0.006 s
SDKi: ziti-sdk:channel.c:231 new_ziti_channel() ch[0] (ACHITRAPUR-LT-edge-router@tls://ACHITRAPUR-LT:3022) new channel for ztx[0] identity[weather.demo]
SDKi: ziti-sdk:channel.c:742 reconnect_channel() ch[0] reconnecting NOW
SDKd: ziti-sdk:channel.c:713 reconnect_cb() ch[0] connecting to ACHITRAPUR-LT:3022
SDKd: ziti-sdk:ziti_ctrl.c:324 ctrl_body_cb() ctrl[ACHITRAPUR-LT] completed GET[/current-api-session/service-updates] in 0.042 s
SDKd: ziti-sdk:ziti_ctrl.c:774 ctrl_paging_req() ctrl[ACHITRAPUR-LT] starting paging request GET[/services]
SDKd: ziti-sdk:ziti_ctrl.c:324 ctrl_body_cb() ctrl[ACHITRAPUR-LT] completed GET[/services?limit=25&offset=0] in 0.003 s
SDKd: ziti-sdk:ziti_ctrl.c:340 ctrl_body_cb() ctrl[ACHITRAPUR-LT] received 1/1 for paging request GET[/services]
SDKd: ziti-sdk:ziti_ctrl.c:352 ctrl_body_cb() ctrl[ACHITRAPUR-LT] completed paging request GET[/services] in 0.007 s
SDKd: ziti-sdk:ziti.c:1146 update_services() ztx[0] sending service event 1 added, 0 removed, 0 changed
SDKd: ziti-sdk:channel.c:861 on_channel_connect_internal() ch[0] connected
SDKi: ziti-sdk:channel.c:640 hello_reply_cb() ch[0] connected. EdgeRouter version: v0.26.11|807dd591b1f5|2022-11-10T14:53:29Z|linux|amd64
SDKi: ziti-sdk:posture.c:204 ziti_send_posture_data() ztx[0] first run or potential controller restart detected
SDKd: ziti-sdk:posture.c:211 ziti_send_posture_data() ztx[0] posture checks must_send set to TRUE, new_session_id[TRUE], must_send_every_time[TRUE], new_controller_instance[TRUE]
Request:
Method: GET, RequestUri: ‘https://wttr.in/’, Version: 1.1, Content: , Headers:
{
User-Agent: curl/7.59.0
}
SDKd: ziti-sdk:zitilib.c:634 do_ziti_connect() connecting fd[1632] to (null):0
SDKd: ziti-sdk:zitilib.c:689 do_ziti_connect() connecting fd[1632] to service[weather-svc]
SDKd: ziti-sdk:posture.c:211 ziti_send_posture_data() ztx[0] posture checks must_send set to TRUE, new_session_id[FALSE], must_send_every_time[TRUE], new_controller_instance[FALSE]
SDKd: ziti-sdk:connect.c:518 process_connect() conn[0.0/Connecting] requesting ‘Dial’ session for service[weather-svc]
SDKd: ziti-sdk:ziti_ctrl.c:324 ctrl_body_cb() ctrl[ACHITRAPUR-LT] completed POST[/sessions] in 0.013 s
SDKd: ziti-sdk:connect.c:480 connect_get_net_session_cb() conn[0.0/Connecting] got session[clbmgmfud1mbogvs120lnq0so] for service[weather-svc]
SDKd: ziti-sdk:posture.c:211 ziti_send_posture_data() ztx[0] posture checks must_send set to TRUE, new_session_id[FALSE], must_send_every_time[TRUE], new_controller_instance[FALSE]
SDKd: ziti-sdk:connect.c:528 process_connect() conn[0.0/Connecting] starting Dial connection for service[weather-svc] with session[clbmgmfud1mbogvs120lnq0so]
SDKd: ziti-sdk:connect.c:411 ziti_connect() conn[0.0/Connecting] selected ch[ACHITRAPUR-LT-edge-router@tls://ACHITRAPUR-LT:3022] for best latency(6 ms)
SDKd: ziti-sdk:connect.c:299 on_channel_connected() conn[0.0/Connecting] selected ch[ACHITRAPUR-LT-edge-router@tls://ACHITRAPUR-LT:3022] status[0]
SDKd: ziti-sdk:channel.c:211 ziti_channel_add_receiver() ch[0] added receiver[0]
SDKi: ziti-sdk:channel.c:837 on_channel_data() ch[0] channel was closed [-4095/end of file]
SDKe: ziti-sdk:connect.c:926 connect_reply_cb() conn[0.0/Connecting] failed to connect [-20/Unknown system error -20]
SDKw: ziti-sdk:zitilib.c:591 on_ziti_connect() failed to establish ziti connection: -23(connection is closed)
SDKd: ziti-sdk:zitilib.c:565 on_bridge_close() closed conn for socket(1632)
SDKd: ziti-sdk:connect.c:1404 queue_edge_message() conn[0.0/Closed] closed due to err[-20](Connection to edge router terminated)
SDKw: ziti-sdk:connect.c:1417 queue_edge_message() conn[0.0/Closed] disconnecting from state[9]
SDKd: ziti-sdk:ziti.c:334 ziti_force_api_session_refresh() ztx[0] forcing session refresh
SDKd: ziti-sdk:ziti.c:329 ziti_schedule_api_session_refresh() ztx[0] ziti_schedule_api_session_refresh: scheduling api session refresh: 0ms
SDKi: ziti-sdk:channel.c:739 reconnect_channel() ch[0] reconnecting in 8863 ms (attempt = 1)
SDKi: ziti-sdk:channel.c:837 on_channel_data() ch[0] channel was closed [-4095/end of file]
SDKd: ziti-sdk:ziti.c:334 ziti_force_api_session_refresh() ztx[0] forcing session refresh
SDKd: ziti-sdk:ziti.c:329 ziti_schedule_api_session_refresh() ztx[0] ziti_schedule_api_session_refresh: scheduling api session refresh: 0ms
SDKi: ziti-sdk:channel.c:739 reconnect_channel() ch[0] reconnecting in 14292 ms (attempt = 2)
SDKd: ziti-sdk:ziti.c:840 api_session_refresh() ztx[0] api_session_refresh running
SDKd: ziti-sdk:ziti.c:302 is_api_session_expired() ztx[0] is_api_session_expired[FALSE] - default case
SDKd: ziti-sdk:ziti.c:855 api_session_refresh() ztx[0] api_session_refresh refreshing api session by querying controllerSDKd: ziti-sdk:ziti_ctrl.c:324 ctrl_body_cb() ctrl[ACHITRAPUR-LT] completed GET[/current-api-session] in 0.075 s
SDKd: ziti-sdk:ziti_ctrl.c:257 ctrl_login_cb() ctrl[ACHITRAPUR-LT] authenticated successfully session[clbmgmbe41mbggvs1l202806w]
SDKd: ziti-sdk:ziti.c:1449 api_session_cb() ztx[0] refreshed successfully => api_session[clbmgmbe41mbggvs1l202806w]
SDKd: ziti-sdk:ziti.c:1399 ziti_set_api_session() ztx[0] ziti api session expires in 1794 seconds
SDKi: ziti-sdk:ziti.c:1423 ziti_set_api_session() ztx[0] api session set, setting api_session_timer to 1740s
SDKd: ziti-sdk:ziti.c:329 ziti_schedule_api_session_refresh() ztx[0] ziti_schedule_api_session_refresh: scheduling api session refresh: 1740000ms
SDKd: ziti-sdk:ziti.c:284 ziti_set_fully_authenticated() ztx[0] setting api_session_state[3] to 3
SDKd: ziti-sdk:ziti.c:284 ziti_set_fully_authenticated() ztx[0] setting api_session_state[3] to 3
SDKd: ziti-sdk:ziti_ctrl.c:774 ctrl_paging_req() ctrl[ACHITRAPUR-LT] starting paging request GET[/current-identity/edge-routers]
SDKd: ziti-sdk:channel.c:713 reconnect_cb() ch[0] connecting to ACHITRAPUR-LT:3022
SDKd: ziti-sdk:posture.c:211 ziti_send_posture_data() ztx[0] posture checks must_send set to TRUE, new_session_id[FALSE], must_send_every_time[TRUE], new_controller_instance[FALSE]
Sample failed to execute: One or more errors occurred. (connection is closed (wttr.in:443))
SDKd: ziti-sdk:channel.c:861 on_channel_connect_internal() ch[0] connected
SDKi: ziti-sdk:channel.c:640 hello_reply_cb() ch[0] connected. EdgeRouter version: v0.26.11|807dd591b1f5|2022-11-10T14:53:29Z|linux|amd64
SDKd: ziti-sdk:ziti_ctrl.c:324 ctrl_body_cb() ctrl[ACHITRAPUR-LT] completed GET[/current-identity] in 45.061 s
SDKd: ziti-sdk:ziti_ctrl.c:324 ctrl_body_cb() ctrl[ACHITRAPUR-LT] completed GET[/current-identity] in 45.059 s
SDKd: ziti-sdk:ziti_ctrl.c:324 ctrl_body_cb() ctrl[ACHITRAPUR-LT] completed GET[/current-identity/edge-routers?limit=25&offset=0] in 0.162 s
SDKd: ziti-sdk:ziti_ctrl.c:340 ctrl_body_cb() ctrl[ACHITRAPUR-LT] received 1/1 for paging request GET[/current-identity/edge-routers]
SDKd: ziti-sdk:ziti_ctrl.c:352 ctrl_body_cb() ctrl[ACHITRAPUR-LT] completed paging request GET[/current-identity/edge-routers] in 45.061 s
SDKd: ziti-sdk:channel.c:276 ziti_channel_connect() ztx[0] existing ch0 found for ingress[tls://ACHITRAPUR-LT:3022]
SDKd: ziti-sdk:ziti_ctrl.c:324 ctrl_body_cb() ctrl[ACHITRAPUR-LT] completed GET[/current-api-session/service-updates] in 0.157 s
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task1.GetResultCore(Boolean waitCompletionNotification) at System.Threading.Tasks.Task
1.get_Result()
at OpenZiti.Samples.Weather.Run(String args) in C:\Repos\GitHub\Samples\Weather.cs:line 41
at OpenZiti.Samples.Program.Main(String args) in C:\Repos\GitHub\Samples\Program.cs:line 26
I see a bug in the setup script. See ziti-sdk-csharp/weather.ps1 at main · openziti/ziti-sdk-csharp · GitHub
There’s no space between the closing quote and the double hyphen. That might be the cause:
ziti edge create service 'weather-svc'--configs ..... (no space)
should be
ziti edge create service 'weather-svc' --configs ..... (has the space)
I’ll push a patch for that shortly, I think that’s what happened. I’ll try to replicate that as well. thx
Hi @TheLumberjack, Thanks for your updates.
We have created Endpoint, Service and AppWan for Weather sample in Ziti Console using our NetFoundry account. We followed the same steps as like the below community discussion.
Post creation of above steps, downloaded the jwt file from ziti console and completed the enrollment process using the sample app and got the respective Json file. But when we try to fetch the weather details by passing Json as input, facing ‘Location access violation’ error. PFA.
Where we need to set the location either it picks automatically from device or need to set it somewhere in project?
PFB the sample Weather project we tried to get Weather details.
https://drive.google.com/file/d/1QxNZyK_QrgyIb9EDC9ls2A3pyA9Cb9Gf/view?usp=sharing
This sample project has older .NET version of SDK because that is compatible to our application.
Kindly help us resolving Access location violation issue.
Hi @RS_MOB, the “Access violation”, from my experience, has always been a problem of the launch arch not matching the library. Native libs and dotnet can sometimes be a little tricky. Previous SDKs might have had issues determining exactly which native arch to launch…
Also, thanks for the project. I downloaded it and opened/ran the Ziti.Samples.sln just as it came from that zip file. However, it launched under “Any CPU” (the only configuration in the solution) fine. I added an x64 and an x86 and both of those launched fine too, which confused me. I expected to see the access violation you referenced with one or the other.
Do you have any more details you can share about how you launched the app? Any parameters, run config etc? I can’t trigger the problem you’re seeing yet…
Also, the older SDK functions/API was replaced with the “Ziti_lib” functionality from the CSDK. I’m concerned for you that using the older code will make a bit of work when you upgrade later on. Please do be aware of that. If there are functions in the older library that you need/want, I’d like to hear that feedback too as it’ll help us determine what functionality people are wanting/using.
I’m also interested in your dotnet version – what are you running? Is it .NET Framework 4.x? or .netcore 3?
Hi @TheLumberjack Thanks for the update.
We are still facing the same Access violation issue during runtime of C# console application.
Since eventually we need this SDK to be implemented in Xamarin based Mobile application which is on C#. So we tried sample mobile app with Ziti.NET.Standard nuget versions from 0.7.112.23262 till 0.8.300.26813 to get Weather details but facing below exception during runtime,
{System.TypeInitializationException: The type initializer for ‘OpenZiti.API’ threw an exception. —> System.TypeInitializationException: The type initializer for ‘OpenZiti.UVLoop’ threw an exception. —> System.DllNotFoundException: ziti4dotnet assembly: type: member:(null)
at (wrapper managed-to-native) OpenZiti.Native.API.z4d_default_loop()
at OpenZiti.UVLoop…cctor () [0x00000] in D:\a\ziti-sdk-csharp\ziti-sdk-csharp\Ziti.NET.Standard\src\OpenZiti\UVLoop.cs:21
— End of inner exception stack trace —
at OpenZiti.API…cctor () [0x0001d] in D:\a\ziti-sdk-csharp\ziti-sdk-csharp\Ziti.NET.Standard\src\OpenZiti\API.cs:91
— End of inner exception stack trace —
at OpenZiti.ZitiIdentity…ctor (OpenZiti.ZitiIdentity+InitOptions opts) [0x0002e] in D:\a\ziti-sdk-csharp\ziti-sdk-csharp\Ziti.NET.Standard\src\OpenZiti\ZitiIdentity.cs:52
at Ziti_ZeroTrust.Weather.Run (System.String identityFile) [0x00064] in C:\Ziti_ZeroTrust\Ziti_ZeroTrust\Ziti_ZeroTrust\Weather.cs:39
at Ziti_ZeroTrust.MainPage.Program (System.String args) [0x0004e] in C:\Ziti_ZeroTrust\Ziti_ZeroTrust\Ziti_ZeroTrust\MainPage.xaml.cs:45 }
Kindly help us on resolving this issue.
Hi @RS_MOB,
I’ve not tried the .NET sdk with xamarin myself, so I don’t know what sort of issues might happen when I try that.
I’ll spend some time and try to make a sample Xamarin app and see how it goes for me…
@RS_MOB, I was updating my environment and looking things over when I found a StackOverflow post indicating that Xamarin was deprecated and leaving support in 2024. Microsoft link to the announcement here.
From that page:
.NET 6 takes over from Xamarin for building Android, iOS, and cross-platform applications. Xamarin.Android and Xamarin.iOS projects should be upgraded to .NET SDK-style projects. Xamarin.Forms projects should be upgraded to .NET Multi-platform App UI (MAUI).
Would an example that uses MAUI be acceptable? I’d like to keep us up-to-date with “current/future” best practices and it sounds like that’s MAUI, not xamarin. Let me know please, thanks
@TheLumberjack Thanks for your update.
MAUI is in our roadmap, should take another 6 to 8 months for adoption. Xamarin is our current platform for our mobile application and will continue to use it till Microsoft supports it.
We will wait for your sample Xamarin app
Hi:
Recently, when I try OpenZiti on Ubuntu 22.04, there are two problems I cannot solve.
First:
We want to use the Python SDK in our local simple server-client Python application, we create the two Python codes and after we do this :
pip install Openziti
We still need the id.json file.
However, I cannot generate the id.json file correctly after several trys. Could you please provide some guidances on Python SDK?
The second problem:
After I found I cannot solve above problem, I was trying to find the similar problem in this forum. Then, I found this C# sample. Everything runs well in the beginning. However, when I try the C# sample:
I got the following error:
ziti-sdk-csharp-main/Samples$ ls
bin
HostedService.cs
OpenZitiSamples.csproj
SampleBase.cs
Weather.cs
Enrollment.cs
LoggingHandler.cs
Program.cs
setup-scripts
HostedServiceClient.cs
obj
Properties
Util
$ dotnet run OpenZitiSamples.csproj weather
ziti-sdk-csharp-main/Samples/OpenZitiSamples.csproj : warning NU1603: OpenZitiSamples depends on OpenZiti.NET (>= 0.8.339.37518) but OpenZiti.NET 0.8.339.37518 was not found. An approximate best match of OpenZiti.NET 0.8.339.42160 was resolved.
iti-sdk-csharp-main/Samples/OpenZitiSamples.csproj : warning NU1603: OpenZitiSamples depends on OpenZiti.NET (>= 0.8.339.37518) but OpenZiti.NET 0.8.339.37518 was not found. An approximate best match of OpenZiti.NET 0.8.339.42160 was resolved.
ziti-sdk-csharp-main/Samples/Program.cs(8,16): error CS0234: The type or namespace name 'legacy' does not exist in the namespace 'OpenZiti' (are you missing an assembly reference?) [/ziti-sdk-csharp-main/Samples/OpenZitiSamples.csproj]
ziti-sdk-csharp-main/Samples/Program.cs(61,43): error CS0246: The type or namespace name 'ZitiEnrollment' could not be found (are you missing a using directive or an assembly reference?) [/ziti-sdk-csharp-main/Samples/OpenZitiSamples.csproj]
The build failed. Fix the build errors and run again.
$ dotnet run OpenZitiSamples.csproj
ziti-sdk-csharp-main/Samples/OpenZitiSamples.csproj : warning NU1603: OpenZitiSamples depends on OpenZiti.NET (>= 0.8.339.37518) but OpenZiti.NET 0.8.339.37518 was not found. An approximate best match of OpenZiti.NET 0.8.339.42160 was resolved.
iti-sdk-csharp-main/Samples/OpenZitiSamples.csproj : warning NU1603: OpenZitiSamples depends on OpenZiti.NET (>= 0.8.339.37518) but OpenZiti.NET 0.8.339.37518 was not found. An approximate best match of OpenZiti.NET 0.8.339.42160 was resolved.
ziti-sdk-csharp-main/Samples/Program.cs(8,16): error CS0234: The type or namespace name 'legacy' does not exist in the namespace 'OpenZiti' (are you missing an assembly reference?) [/ziti-sdk-csharp-main/Samples/OpenZitiSamples.csproj]
ziti-sdk-csharp-main/Samples/Program.cs(61,43): error CS0246: The type or namespace name 'ZitiEnrollment' could not be found (are you missing a using directive or an assembly reference?) [/ziti-sdk-csharp-main/Samples/OpenZitiSamples.csproj]
The build failed. Fix the build errors and run again.
$ dotnet run OpenZitiSamples.csproj HostedService
... ... same error above
$ dotnet --version
6.0.408
Thank you vert much
Looking forward hearing from you
Can you elaborate on how you tried to make the id and which python sample you’re running?
For the C# demo, it seems like our dependency is out of date in nuget somehow. I’ll see if I can fix that, thanks for letting us know.
Hi @Nick, I pushed a chang out to main to fix that sample. Do note that the proper way of running it from the Samples folder is by running just dotnet run weather
. Thanks for pointing that out
Take a look a this gif I just made and you can watch me run it
Hi:
Thank you for your solution.
However, when I do that, it show following output:
~/Desktop/ziti-sdk-csharp-main/Samples$ ziti edge login
Using controller url: https://klabzhao:1280/edge/management/v1 from identity 'default' in config file: /home/klabzhao/.ziti/quickstart/klabzhao/ziti-cli.json
Using username: admin from identity 'default' in config file: /home/klabzhao/.ziti/quickstart/klabzhao/ziti-cli.json
Enter password:
Token: 20d07db3-201d-40e5-bd58-9337a460a6f6
Saving identity 'default' to /home/klabzhao/.ziti/quickstart/klabzhao/ziti-cli.json
~/Desktop/ziti-sdk-csharp-main/Samples$ pwsh setup-scripts/weather.ps1
Router list:
- klabzhao-edge-router
Enter the name of the edge router to use for offload from the OpenZiti overlay: klabzhao-edge-router
EdgeRouter identity: klabzhao-edge-router will be used as the router to offload traffic for the demo.
EdgeRouter identity: klabzhao-edge-router already has the expected attribute [weather-svc.binders]. No need to update, skipping.
weather.demo identity exists. Delete and overwrite?: y
delete of identity with id yB6tj9v.P5: OK
creating identity: weather.demo
Looks like the service already exists. Try to cleanup/start again?: y
Cleaning up...
delete of config with id 5byzTXTricLiHtsKvSxCz0: OK
delete of config with id 53hJRiaGKVnHxiRthFzpdZ: OK
delete of service with id 5GvWi147vVb1ruqxVKTL0B: OK
delete of service-policy with id 7FmniOg0jzDUpa95EKaYbN: OK
delete of service-policy with id 5RYpPjF5CFfKzACIG2OlqU: OK
Clean up complete.
New config weather-svc.host.v1 created with id: 46kA8TelbK085NjNSnVooC
New config weather-svc.intercept.v1 created with id: 51ZZKfS1XJaDBVPAzrMx1k
New service weather-svc created with id: 6D2TOIuKNx4qlqofPRXHw3
New service policy weather-svc-dial created with id: fx6qdy41LonWNXZxMYMZ0
New service policy weather-svc-bind created with id: 6vWGaAiInNyrNFSSa9Qwz5
=====================================================
Setup for weather.svc is complete
If this is the first time running this script, allow
time for the services to propegate to the router
before running the sample or you may receive an error
like: no terminators exist for service
then, execute the sample using:
dotnet run weather setup-scripts/weather.demo.jwt
=====================================================
~/Desktop/ziti-sdk-csharp-main/Samples$ dotnet run weather setup-scripts/weather.demo.jwt
/home/klabzhao/Desktop/ziti-sdk-csharp-main/Samples/OpenZitiSamples.csproj : warning NU1603: OpenZitiSamples depends on OpenZiti.NET (>= 0.8.339.37518) but OpenZiti.NET 0.8.339.37518 was not found. An approximate best match of OpenZiti.NET 0.8.339.42160 was resolved.
/home/klabzhao/Desktop/ziti-sdk-csharp-main/Samples/OpenZitiSamples.csproj : warning NU1603: OpenZitiSamples depends on OpenZiti.NET (>= 0.8.339.37518) but OpenZiti.NET 0.8.339.37518 was not found. An approximate best match of OpenZiti.NET 0.8.339.42160 was resolved.
~/Desktop/ziti-sdk-csharp-main/Samples$ dotnet run weather
/home/klabzhao/Desktop/ziti-sdk-csharp-main/Samples/OpenZitiSamples.csproj : warning NU1603: OpenZitiSamples depends on OpenZiti.NET (>= 0.8.339.37518) but OpenZiti.NET 0.8.339.37518 was not found. An approximate best match of OpenZiti.NET 0.8.339.42160 was resolved.
/home/klabzhao/Desktop/ziti-sdk-csharp-main/Samples/OpenZitiSamples.csproj : warning NU1603: OpenZitiSamples depends on OpenZiti.NET (>= 0.8.339.37518) but OpenZiti.NET 0.8.339.37518 was not found. An approximate best match of OpenZiti.NET 0.8.339.42160 was resolved.
~/Desktop/ziti-sdk-csharp-main/Samples$
After above, there is no further output, which should be the weather info.
Do you have an idea about this ?
BTW, all the above codes are running on local Debian machine in a same terminal.
Hmmm. “no output” is definitely unexpected. It looks like the “native” logging isn’t working on this sample.
OpenZiti.Logging.SimpleConsoleLogging(LogLevel.Trace);
OpenZiti.API.NativeLogger = OpenZiti.API.DefaultNativeLogFunction;
Those lines are usually commented out. I’ll dig in a bit more. My guess is that your client isn’t able to connect to an edge router or to your controller and it’s just sitting there never timing out.
I ran from Ubuntu on WSL, I don’t think that would matter and it’s debian-flavored. I’m more troubled the lack of output though. Do you see any logs from your router at all?
After I changed OS to Ubuntu 22.04.2, it becomes better.
However, there is still an error in the last step:
I am not sure if it is the problem in C# code, or it is problem in my configuration:
~/Desktop/ziti-sdk-csharp-main/Samples$ dotnet run weather setup-scripts/weather.demo.jwt
/home/nick/Desktop/ziti-sdk-csharp-main/Samples/OpenZitiSamples.csproj : warning NU1603: OpenZitiSamples depends on OpenZiti.NET (>= 0.8.339.37518) but OpenZiti.NET 0.8.339.37518 was not found. An approximate best match of OpenZiti.NET 0.8.339.42160 was resolved.
/home/nick/Desktop/ziti-sdk-csharp-main/Samples/OpenZitiSamples.csproj : warning NU1603: OpenZitiSamples depends on OpenZiti.NET (>= 0.8.339.37518) but OpenZiti.NET 0.8.339.37518 was not found. An approximate best match of OpenZiti.NET 0.8.339.42160 was resolved.
Strong identity enrolled successfully. File saved to: /home/nick/Desktop/ziti-sdk-csharp-main/Samples/weather.demo.json
Request:
Method: GET, RequestUri: 'https://wttr.in/', Version: 1.1, Content: <null>, Headers:
{
User-Agent: curl/7.59.0
}
Response:
StatusCode: 503, ReasonPhrase: 'Service Unavailable', Version: 1.1, Content: System.Net.Http.HttpConnectionResponseContent, Headers:
{
Access-Control-Allow-Origin: *
Date: Wed, 26 Apr 2023 22:42:51 GMT
Content-Length: 359
Content-Type: text/plain; charset=utf-8
}
Sorry, we are running out of queries to the weather service at the moment.
Here is the weather report for the default city (just to show you what it looks like).
We will get new queries as soon as possible.
You can follow https://twitter.com/igor_chubin for the updates.
======================================================================================
===============================================================================================
==============================================================
Sample failed to execute: One or more errors occurred. (Response status code does not indicate success: 503 (Service Unavailable).)
at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
at System.Threading.Tasks.Task`1.get_Result()
at OpenZiti.Samples.Weather.Run(String[] args) in /home/nick/Desktop/ziti-sdk-csharp-main/Samples/Weather.cs:line 42
at OpenZiti.Samples.Program.Main(String[] args) in /home/nick/Desktop/ziti-sdk-csharp-main/Samples/Program.cs:line 26
==============================================================
Is there anyone meet this output:
Sorry, we are running out of queries to the weather service at the moment.
Here is the weather report for the default city (just to show you what it looks like).
We will get new queries as soon as possible.
You can follow https://twitter.com/igor_chubin for the updates.
I think, it means the application build is correct, just the weather service from “wttr.in” not available, right ?
OR, it is my building problem ?
Yeah that’s what happens when they service too many requests. If you’re getting that response, it worked! As for debian, I wonder if you had a firewall enabled that ubuntu didn’t have enabled?
Looks like it worked!