Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suddently my app stop work #353

Closed
tabutnas opened this issue Jul 16, 2018 · 2 comments
Closed

Suddently my app stop work #353

tabutnas opened this issue Jul 16, 2018 · 2 comments
Labels

Comments

@tabutnas
Copy link

Hello,

i dont know why my app stop work, when i try to connect by ZendekApi_v2 Version runtime "v4.0.30319".

First at all i wanted to know why the object "api" don't have any method to know if conect o whatever fail.

And the problem is when i try to connect to my domain and credentials, api.Tickets.CreateTicket, send the follow inner exception; "Object reference not set to an instance of an object."

This is my code;

using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using NUnit.Framework;
using ZendeskApi_v2;
using ZendeskApi_v2.Requests;
using ZendeskApi_v2.Extensions;
using ZendeskApi_v2.Models.Users;
using ZendeskApi_v2.Models.Shared;
using ZendeskApi_v2.Models.Constants;
using ZendeskApi_v2.Models.Tickets;
using OliviaSistemas.Utils.ZendeskInterface.Helpers;

namespace ZendeskInterfaceTestApp
{
    class Program
    {
        static void Main(string[] args)
        {
            try
            {
                Console.WriteLine("TESTING");
                CreateSampleTickets01(10);
                Console.WriteLine("Done");
            }
            catch (Exception ex)
            {
                Console.WriteLine("ERROR e: {0} Json MSG: {1}", ex.Message, ex.Data["jsonException"]);
               // Assert.IsTrue(ex.Message.Contains("Email: cannot be blank") && ex.Data["jsonException"] != null && ex.Data["jsonException"].ToString().Contains("Email: cannot be blank"));

            }
            finally
            {
                Console.ReadKey();
            }
        }

    internal static void CreateSampleTickets01(int count = 10)
        {
            String page = "";
ZendeskApi_v2.ZendeskApi api = new ZendeskApi_v2.ZendeskApi(
                "https://****.zendesk.com/api/v2",
                "****@****.net",
                "****",
                "****");

            for (int i = 0; i < count; i++)
            {
                System.Threading.Thread.Sleep(1000);

                String subject = "Olivia Test - " + DateTime.Now.ToString();
                api.Tickets.CreateTicket(new Ticket
                {
                    Requester = new Requester { Email = "[email protected]", Name = " Marc Ibañez" },
                    Type = TicketTypes.Question,
                    Subject = subject,
                    Comment = new Comment { Body = subject + " (this is a test)" }
                });

                Console.WriteLine("Ticket created: {0}", subject);
            } }


Thanks in advance

@mozts2005
Copy link
Member

Based on my reading of the sample that you have listed you may be having a TLS/SSL please see issues #339 for how to fix that.

If you find that is not the issue. Please post the full stack trace for the exception.

@tabutnas
Copy link
Author

tabutnas commented Jul 19, 2018

Thanks @mozts2005 ,

the problem was here -> https://support.zendesk.com/hc/en-us/articles/360000710347-Removal-of-support-for-TLS-protocol-versions-1-0-and-1-1

So the solution is enable suported TLS, in my case i enable TLS 1.2 on my program and work well now :)

I apply the following code for do that
https://stackoverflow.com/questions/28286086/default-securityprotocol-in-net-4-5/48902721#48902721

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants