Pages

Wednesday, March 21, 2018

MVC: A public action method ... was not found on controller

You have a page with something embedded, a partial view, a generated image, or something.  And it's odd, but the first time you load the page, everything works, but every time you reload (like someone clicks a button on the page), MVC claims it can't find the action.

InnerException:
ErrorCode=-2147467259
HResult=-2147467259
Message=A public action method ... was not found on controller '...Controller'.
Source=System.Web.Mvc
WebEventCode=0

You check and the action is right there!.  In my case it looked like this.

//Get: ProductPartial Blocks
[HttpGet]
[AllowAnonymous]
public ActionResult ProductBlockPartial(int? ID)
{
if (ID.HasValue)
{
Product model = db.Products.Find(ID);
return PartialView(model);
}
else
{ return null; }
}

The answer, my friend, is that pesky [HttpGet].  That tells the action to only respond to get requests, and when you pushed the button to post data back to the page, it became a post.  And the post flows down from the main page to the partial view as well.
Just remove the [HttpGet] from the action and you're good as gold!

...

Bryan Valencia is a contributing editor and founder of Visual Studio Journey.  He owns and operates Software Services, a web design and hosting company in Manteca, California.

Support

Back in the annals of history, companies wanted people to buy their software.  Most bought software came with a thing we used to call support.

Soon, places like Apple and Microsoft were getting 650 billion calls a day from every grandma that couldn't figure out how to get the cup holder to pop out.

What we really need, thought the beleaguered support operators; is a way to prevent people from accessing support. 

Support Barriers
I used to email support with a simple problem, or file a help ticket, and In the 90's I started seeing this...

I can't get the mouse to select the object in the window.

I started seeing responses like this:

Please tell us:

  • the model of your pc, 
  • the exact version of Windows, 
  • the serial number on your motherboard,
  • the embedded digital signature of your CPU
  • The exact amount of RAM, and wither it's DRAM or SRAM,
  • The exact error message you are seeing,
    • in Gaelic
  • Your exact DNA sequence,
  • and the serial number of your ISP's router.
In other words, that should get him off our backs for a while...


Expensive Support
Many things were tried.  I once had a Microsoft update eff up my web server and I waited 3 hours on hold, got a tech, and explained my problem.

His first question was, How will you be paying for this?

I won't,  I said.  You did this, not me.

Sorry, no support without payment.

OK, how much is it?

$400 to get through for 15 minutes, and there's no guarantee we will solve your problem.

But I paid over $400 for the server software to begin with!  

Sorry.  Credit card or pound sand.

I'm sure this way Microsoft could fire 80% of their foreign call center, and get back to the business of putting out flawed updates every 2 days.

Premium Support
Then came the thing where you'd pay $150 for some piece of software, and then $99 a year for premium support.  That's fine if you're using something big and mission critical, but with different support agreements on your word processing, email, databases, and on and on,  you end up paying a LOT of money every month for support.

SAAS
This is the latest in irony.  Software as a service.  It's partiucularly ironic because it contains the word service.  What SAAS means is that when you buy software, you're not buying anything.  In fact there are some packages (I'm looking at you Adobe Creative Cloud) that they want you to pay monthly for.

So all these guys who are making videos for YouTube now have to pay up monthly, while those of us who just wanted to add titles to a company presentation once, are OUT.

The truth is that you never OWNED software in the first place.  You held a limited license to use it.  If you OWNED Excel, you could sell it to someone else, or freely modify it.  It's not like a lawnmower, with which you can do what you like, it's more like paying to hear a song at a concert or a movie at a theater.  You don't OWN Star Wars because you saw it.

But I digress.

No Support
I just paid $50 for some software that made some claims on their web page, but due to a glaring BUG, it doesn't work on my machine.  I clicked support and got this:

If you have any issue with your purchase or related to the configuration of [the software], please post your request in the [user] forums, in the Troubleshooting section.
So, you fling out software, charge money, and then leave it to other users to figure out the problems by themselves?

Lawnmowers
It should be noted that anytime I have a question or problem about my lawnmower, I can still call the manufacturer.

Freeware, Shareware, Open Source
So I can fully understand why many people left the world of paid software and embraced free software.  There is usually a large user community, and you can even download it and modify it yourself (not that I would ever do that). 

The thing with open source is that there is still no support - but there is also no expectation of support.  Some small team of developers all over the world kind of run the project, and they all work for free in their mom's dank basement surrounded by Burger King and Dorito's bags.

These guys usually have Bugzilla going and they take the flurry if bugs from the clients, and choose some to rectify.  But the forums... that is a different animal.

Here's what software development looks like from a development teams point of view.


  1. You and a few friends decide that it would be cool to have an open source version of (x).
  2. Work for 3 years (for free) in every spare moment with the team to get the software where you want it.
  3. Miss your deadline and work another two years, promising that it'll be next month 24 times.
  4. Finally you get a working build (YAY)
  5. You release it to the webosphere.
  6. Here come the comments!
    1. Waited too long for crap software!
    2. It doesn't have all the features that the commercial $300 + $50 a month package has.
    3. When is it coming out for Mac?
    4. When is it coming out for Linux?
    5. It sicks. You suck. Drink bleach.
    6. I tried posting 50 messages on the forums, and no response from the team
    7. Why isn't there a Latvian version?
  7. So now you have 6,000 requests, of which there are maybe 20 real issues, and everyone thinks you can just quick-fix their thing.
    1. even though the source is open, they can download it and try to fix it at any time.
  8. Everyone gets mental when you don't release weekly bug patches.
  9. One or two people really praise it, but everyone else gripes about it.
  10. After about 2 years, no one wants to work on the project anymore, and there are no more updates.
  11. People continue to download it and fill the forums with requests, only to give up when no one answers.



...

Bryan Valencia is a contributing editor and founder of Visual Studio Journey.  He owns and operates Software Services, a web design and hosting company in Manteca, California.

Monday, March 12, 2018

How to Copy a MSSQL Server database to a New Webhost without RESTORE

This article explains how to copy a database from one server to another when Backup/Restore is not an option.

  • This will work as long as you have SQL Server Management Studio access to the source and destination databases.
  • This is very slow, and may take many hours to run on a big database.
  1. First, open the database server you want to copy in SSMS.
  2. Next, Right-click the database, Tasks -> Generate Scripts.
     
  3. In my case I want all the scripts to completely recreate my database, so here are the steps.
  4. Next
  5. Script entire database and all database objects
  6. Save to new query window (file is OK too).
  7. Click Advanced (by default it will write a script to create all objects, but not copy data).

    Make sure to select Schema and data.
  8. Review all the other settings to make sure you get the stuff you want on the destination database.  Click OK, then Next.
  9. Review and Next (or previous if you need to change something.)
  10. You'll get a checklist screen and then the script is done.  It should pop up in SSMS.
To restore the database...
  1. Log SSMS into the destination database.
  2. Back up what's there if there is any chance you'll need it.
  3. In your script, if you need to rename the database to satisfy the new hosting company, do a global replace in the SQL script.  Make sure the FileNames reflect the destination database name not the source database
  4. Copy the entire script to the clipboard.
  5. right click the destination database and do a New Query (if the database hasn't been created yet, you can click the server name).
  6. Paste the script into the new query editor.
  7. If the database already exists, you may need to delete the CREATE statement and all the ALTER DATABASE statements, down to the [USE database] command.
  8. Look in the scrollbar for possible problems...  Then fix them.
  9. Run the script and see what happens.  Get coffee.  It's gonna be a while.  Call your Dad.  He misses you.


You're done.  Just in case you don't have all the same Generate Scripts options, this demo was from a SQLExpress2016 database, using all this stuff...

Microsoft SQL Server Management Studio                        14.0.17199.0
Microsoft Analysis Services Client Tools                        14.0.1008.227
Microsoft Data Access Components (MDAC)                        10.0.16299.15
Microsoft MSXML                        3.0 4.0 6.0
Microsoft Internet Explorer                        9.11.16299.0
Microsoft .NET Framework                        4.0.30319.42000
Operating System                        6.3.16299



Share This!

Contact Us

Name

Email *

Message *