none
UWP App Package

    Question

  • Dear Team,

    I have created an app package and installed in windows 10 pc. When i run the application  my sql server was not connected to the application and its simply crashed.

    So please guide me how to side load windows 10 application with Sql sever database connectivity.

    Regards,

    Siva N

    Thursday, January 24, 2019 3:59 PM

All replies

  • What type of server (software) are you using, there are many that can be used; MySQL, SqlCE, SQLServer etc.  Also could you please show us what code you are using currently to connect the the server/db, this will help in providing you with further help. If you could as well, can you capture the exception and post the details here.


    Thursday, January 24, 2019 4:02 PM
  • Hi White,

    I am using SQLServer 2012.

    I have created WCF service application and configure this service in my UWP application. (In UWP app connected service ->  add service reference).

    Here is the code to connect with the server.

    NOTE: I just copy the app package file to another windows 10 pc and install with powershell.

    #region DBConnection

            string DBCon = ConfigurationManager.ConnectionStrings["DBConnection"].ToString();
            SqlConnection Con;
            public void OpenConnection()
            {
                Con = new SqlConnection(DBCon);
                if (Con.State == ConnectionState.Closed)
                {
                    Con.Open();
                }
            }
            public void CloseConnection()
            {
                Con = new SqlConnection(DBCon);
                if (Con.State == ConnectionState.Open)
                {
                    Con.Close();
                }
            }
            #endregion

    Regards,

    Siva N

    Thursday, January 24, 2019 5:00 PM
  • Thanks for the reply Siva.

    I would recommend putting in some code to write to a log or file of some sorts. When you do this you can find out where the problem arises, currently you have no way of finding out. Also I would put some try/catch statements in those methods so you can capture any exceptions that may be happening and then you can log those. At this time, the only thing I can think of is the connection string itself is wrong and could be the main issue.

    Cheers,

    Trevor White

    Note: Posts are provided “AS IS” without warranty of any kind, either expressed or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose.

    Thursday, January 24, 2019 7:02 PM
  • Thanks for your reply White..

    I will check as per your instructions, then i will let you know as soon as possible.

    Thursday, January 24, 2019 7:20 PM
  • You are welcome, good luck and let me know how it goes.


    Regards,

    Trevor White

    Note: Posts are provided “AS IS” without warranty of any kind, either expressed or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose.

    Thursday, January 24, 2019 7:21 PM
  • Hi White,

    Thank you so much i have fixed the issue.

    Can u please suggest me how to do app.config in UWP application? Because i have to write some settings for application.

    Regards,

    Siva N

    Saturday, January 26, 2019 1:35 PM
  • @Siva N,

    Please check the following site:

    https://docs.microsoft.com/en-us/windows/uwp/design/app-settings/app-settings-and-data

    The UWP app support a localsetting and you can use it to store the setting you need:

    https://docs.microsoft.com/en-us/uwp/api/windows.storage.applicationdata.localsettings#Windows_Storage_ApplicationData_LocalSettings

    Best regards,

    Barry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, January 29, 2019 2:20 AM
    Moderator
  • Hello Siva,

    Are you asking about maybe storing user preferences by chance, if so please see application data store which may be what you would need. You might not be able to access the system configuration namespace you would need to get access to the configuration manager, if not please see below for a simple example for the alternatives.

    var uri = new System.Uri("ms-appx:///mytextfile.txt");
    var sampleFile = await Windows.Storage.StorageFile.GetFileFromApplicationUriAsync(uri);

    Or

    var installLocation = Windows.ApplicationModel.Package.Current.InstalledLocation;
    var myFile = await installLocation.GetFileAsync("mytextfile.txt");

    Please clarify what your intentions are so I can better assist you.

    Cheers,

    Trevor White

    Note: Posts are provided “AS IS” without warranty of any kind, either expressed or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose.



    Tuesday, January 29, 2019 1:48 PM
  • Hi White,

    Here is my application error.

    [Timeout expired.  The timeout period elapsed prior to obtaining a connection from the pool.  This may have occurred because all pooled connections were in use and max pool size was reached.]

    After 15 to 20 my application stop working and above error was throwing.

    Regards,

    Siva N

    Thursday, February 7, 2019 7:57 AM
  • Hello Siva,

    "This may have occurred because all pooled connections were in use and max pool size was reached."

    Can you please post the code you are having issue's with? It's possible you are unnecessarily keeping the connections open according to that error above, you need to be closing and also dispose DB connection objects.

    This is more than likely the issue, but it is hard to give you any suggestions just from that error.


    Regards,

    Trevor White

    Note: Posts are provided “AS IS” without warranty of any kind, either expressed or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose.




    Thursday, February 7, 2019 1:43 PM
  • Hi White,

    Here is the coding for DBConnection.

    #region DBConnection

            string DBCon = ConfigurationManager.ConnectionStrings["DBConnection"].ToString();
            SqlConnection Con;
            public void OpenConnection()
            {
                Con = new SqlConnection(DBCon);
                if (Con.State == ConnectionState.Closed)
                {
                    Con.Open();
                }
            }
            public void CloseConnection()
            {
                Con = new SqlConnection(DBCon);
                if (Con.State == ConnectionState.Open)
                {
                    Con.Close();
                }
            }
            #endregion

    When ever i start a new function i have written like below coding.

     public List<ypeList> GetTypeList()
            {
                List<TypeList> TList = new List<TypeList>();

                string Bind = "Here i have written my query";
                OpenConnection();
                SqlCommand cmdBind = new SqlCommand(Bind, Con);
                SqlDataReader Rdr = cmdBind.ExecuteReader();
                while (Rdr.Read())
                {
                    TList.Add(new TypeList { Type = Rdr[0].ToString() });
                }
                Rdr.Close();
                CloseConnection();
                Con.Dispose();
                return TList;
            }

     Still this error was throws.

    ['The request channel timed out attempting to send after 00:01:00. Increase the timeout value passed to the call to Request or increase the SendTimeout value on the Binding. The time allotted to this operation may have been a portion of a longer timeout.']

    For regading this suggest me any idea.

    Regards,

    Siva N

    Monday, February 11, 2019 11:25 AM
  •  Still this error was throws.

    ['The request channel timed out attempting to send after 00:01:00. Increase the timeout value passed to the call to Request or increase the SendTimeout value on the Binding. The time allotted to this operation may have been a portion of a longer timeout.']

    Hello Siva,

    The error listed above is different from your last post, is this a new error you are seeing after fixing the first error or is this first error above still an issue?

    The new error you are seeing is because the service is taking more than one minute to return. A few things I can think of off hand could be: too much data coming back, your queries are taking up to much time and then are timing out etc. You can increase the timeouts, can you post the bindings so I can better assist you?


    Regards,

    Trevor White

    Note: Posts are provided “AS IS” without warranty of any kind, either expressed or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose.

    Monday, February 11, 2019 2:20 PM