404 error running MagicSquare example with MPS

This question was flagged by Walter Roberson
  • Flagged as Unclear by Walter Roberson on 3 Apr 2026 at 7:00.

    needs some reformatting

I'm getting a 404 error when trying to run the magic squares example with a trial of 64-bit MATLAB Production Server R2013b.
  
The issue is that it was working fine, but now isn't.  The error below is obtained in Visual Studio while running the MPS .NET client.  
Any assistance on this is appreciated!
System.Net.WebException: The remote server returned an error: (404) Not Found.    at System.Net.HttpWebRequest.GetResponse()    at MathWorks.MATLAB.ProductionServer.Client.MWHttpHandler.Invoke(Object proxy , MethodInfo method, Object[] parameters)    at Magic.MagicClass\.MagicProxy.mymagic(Int32 in1)    at Magic.MagicClass.Main(String[] args) in \\wapdfp01\brown0$\Visual Studio 2 012\Projects\MPSmagic\MPSmagic\Program.cs:line 33 Web exception caught.    at System.Net.HttpWebRequest.GetResponse()    at MathWorks.MATLAB.ProductionServer.Client.MWHttpHandler.Invoke(Object proxy , MethodInfo method, Object[] parameters)    at Magic.MagicClass\.MagicProxy.mymagic(Int32 in1)    at Magic.MagicClass.Main(String[] args) in \\wapdfp01\brown0$\Visual Studio 2 012\Projects\MPSmagic\MPSmagic\Program.cs:line 33

 Accepted Answer

MathWorks Support Team
MathWorks Support Team on 3 Apr 2026 at 0:00
Edited: MathWorks Support Team on 3 Apr 2026 at 3:49
This error just means the URL is wrong in some form when specifying it in the client, such as at:
MagicSquare mSq = client.CreateProxy<MagicSquare>( new Uri("http://localhost:9910/magic") );
It can specifically be reproduced if the domain is valid (points to some legitimate server, not necessarily MPS), but the requested sub-url is wrong. 
Say the correct URL for MPS server component is: _http://localhost:9910/magic_
 
Then you'll get the 404 error if it's something like: _http://localhost/magic_ 
_http://www.google.com/magic_ 
_http://localhost:9910/magic01_ 
Notice that localhost (which defaults to localhost:80), localhost:9910 and www.google.com are all valid domains, but the sub-url associated with them is not.
  
There is no "/magic" for either localhost:80 or www.google.com.
  
And there is no "/magic01" for localhost:9910. 
Your best bet then is to investigate the MPS URL and check whether it changed ports or whether someone changed its URL somehow (say, by moving the MPS installation to another machine).
  
You can configure the port number in the server with the mps_server_root/config/main_config file. 

More Answers (0)

Products

Release

R2013b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!