Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8586431
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T22:18:32+00:00 2026-06-11T22:18:32+00:00

When using the following code modified from the Azure for Mobile Services website, I

  • 0

When using the following code modified from the Azure for Mobile Services website, I get a “Microsoft.WindowsAzure.MobileServices.MobileServiceInvalidOperationException was unhandledMessage: Internal Server Error (500 InternalServerError – Details: {“code”:500,”error”:”Internal Server Error”})” error.

My code:

    private MobileServiceCollectionView<pin> Pins;
    private IMobileServiceTable<pin> pinTable = App.MobileService.GetTable<pin>();
    public class pin
    {
        public string name { get; set; }
        public long timestamp { get; set; }
        public string type { get; set; }
        public object content { get; set; }
        public string category { get; set; }
        public string comments { get; set; }
        public int Id { get; set; }
    }
    private LiveConnectSession session;
    private async System.Threading.Tasks.Task Authenticate()
    {
        //authentication code from the Azure site, I deleted it here to save space.
    }
    public MainPage()
    {
        this.InitializeComponent();
    }
    public long getTimestamp()
    {
        //Find unix timestamp (seconds since 01/01/1970)
        long ticks = DateTime.UtcNow.Ticks - DateTime.Parse("01/01/1970 00:00:00").Ticks;
        ticks /= 10000000; //Convert windows ticks to seconds
        return ticks;
    }
    public async Task<bool> Refresh()
    {
        List<string> CategoriesMixed = new List<string>();
        Pins = pinTable.Where(pin => true).ToCollectionView();
        if (Pins.Count < 1)
        {
            pin pin = new pin();
            pin.category = "Welcome";
            pin.content = "Hello, World!";
            pin.name = "No Pins :(";
            pin.comments = string.Empty;
            pin.timestamp = getTimestamp();
            pin.type = "text";
            await pinTable.InsertAsync(pin);
        }
        else
        {
            foreach (pin nowPin in Pins)
            {
                await pinTable.DeleteAsync(nowPin); //since I'm still trying to get the inserting pins thing to work, I'm having it delete all pins it finds for the user.
            }
        }
        return true;
    }
    /// <summary>
    /// Invoked when this page is about to be displayed in a Frame.
    /// </summary>
    /// <param name="e">Event data that describes how this page was reached.  The Parameter
    /// property is typically used to configure the page.</param>
    protected override async void OnNavigatedTo(NavigationEventArgs e)
    {
        await Authenticate();
        await Refresh();
    }

One thing that could be important is that I was able to insert one pin into the database, but after that this error is being thrown. Also, if I put a breakpoint at the if(Pins.Count < 1) line, it shows that Pins.Count is returning 0 when there is a pin in the database.

Also, in the Azure Management Portal, I have the following as my script for Insert (from http://www.windowsazure.com/en-us/develop/mobile/tutorials/authorize-users-in-scripts-dotnet/):

function insert(item, user, request) {
  item.userId = user.userId;    
  request.execute();
}

and my script for read:

function read(query, user, request) {
   query.where({ userId: user.userId });    
   request.execute();
}

The error is being thrown on the “await pinTable.InsertAsync(pin);” line within Refresh(). There are no error logs in my Azure management portal. If there’s any other information you need, just ask 🙂

Update 1: I think my problem is related to http://social.msdn.microsoft.com/Forums/en-US/azuremobile/thread/82ae07a1-5832-4dc9-97d7-1cda1fb33bc2, but that question is still unanswered.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T22:18:33+00:00Added an answer on June 11, 2026 at 10:18 pm

    I guess below line is creating problem

    Pins = pinTable.Where(pin => true).ToCollectionView(); 
    

    ToCollectionView(); always returns count as 0. This is the bug here. What do you think Josh Twist?

    Stavros: I think below line can help your program to running smooth

    List<Pin> Pins = await pinTable.Where(pin => true).ToListAsync(); 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using following code to get bitmap from url. This function is used
I'm using the following code (which is a sample from the MSDN slightly modified)
Using following code I try to get updated list of checkbuttons' corresponding text values,
I am using following code to get source for image in wpf (image is
I'm using HttpClient 0.6.0 from NuGet. I have the following C# code: var client
I am using the following code to write the Date Modified time of a
I'm attempting to get the following code from nmdepend to compile const std::string Bfd::packageName(const
I am using the following code to find from current date+time to 30 days
I using following code: var search = 'test'; if ($('#sku').find(search) ){ //alert(search); $(document).find(search).css('color','red'); <TABLE>
I am creating date using following code try { newdatetime = new DateTime(2012, 2,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.