MVC 3 for sub domain

Discussion in 'Site Programming, Development and Design' started by odesuk, Feb 3, 2011.

  1. Can I host my MVC site in subdomain?
    Looks like right now the only way to get to subdomain is via Response redirect.
    Not sure it will work with MVC with it's own url mappings.
    Any Ideas?
  2. Also I'm getting MVC references error:
    Parser Error Message: Could not load file or assembly 'System.Web.Mvc, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

    Source Error:
    Line 23: <add assembly="System.Web.Mvc, Version=, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
  3. Ray


    First of all you'll need to understand that a subdomain name is merely an extension of your domain name that simply points to the site accounts root. There fore you shouldn't get the idea that creating a subdomain name will create you a separate root directory. Rather, you will need to create a subfolder and then use a redirect script to force that subdomain name to point to that subfolder. If you are planning to host multiple web applications such as MVC applications, then you will need to set that subfolder as an application folder. You can do that inside the Winhost control panel under the Site Info Manager/Application Starting Point.

    Now, you are right, using redirect scripts with MVC can be a little tricky but I believe some of our members have successfully done it. You may want to look at some other forum postings and see how redirect/rewrite rules can affect MVC and specifically AJAX calls. Try looking at these thread.

    lastly the best way to approach this problem is build a simple web application first. Try not to be to complicated with it. Upload it to our server and once you have it working you can expand from there.
    Last edited by a moderator: Oct 14, 2015
  4. OK,
    I've move my MVC3 application into the root of my site, added supporting MVC dlls into the bin, but can not run it. I'm getting 404 error. Connection pool is set to Classic, framework is 4.0
  5. Ray


    You have a URL for us to look at?
  6. Ray


    Do you have some kind of URL Rewrite or URL Redirect setup?

    The error message is fairly straight forward. HTTP Error 404.0 - Not Found means it cannot find a specific file or folder and when I checked your account I did not see a folder called "home".
  7. Well Home is a folder under View. MVC should resolve it, right?
  8. Ray


    Not exactly if you set the direct path it is suppose to find the application, it maybe looking directly for the folder Home. Its really difficult to say since we are not the ones who coded your MVC app.

    Lastly make sure you uploaded all the required MVC assemblies/files to your application Bin folder. Otherwise you will continue to see this error...

    Parser Error Message: Could not load file or assembly 'System.Web.Mvc, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
  9. I have removed all my HTML and site is performing as MVC now. The problem is now that non of my webservices work (.*.asmx)
    This is the error: Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.

    Requested URL: /Services/ClinicalStudyService.asmx/FindSubject

    Any Ideas?
    Also, do you have MVC3 Framework installed on that server?

  10. Ray


    Try downloading and installing Fiddler on your personal computer.

    This is a web debugger tool that can log all the http calls your browser sends out to the server. It will give you results that may help shed more light on the application error you are seeing.
  11. I have the same app code running on two other servers without the issue with calling webmethods
    Other test url
    User slava/slava1
    Same as for this site
  12. Ray


    What is the URL for me to replicate this error?
  13. Yes,
    Please login first: slava/slava1
    Go to Manage Users and select a site from drop down. You'll see <html>... message,
    this is the error returned by jQuery web service call (hidden).
    Other place to see an error: Got to "Client Site" -> "Subject" (tab) ->Click Search and you'll see the error again.
  14. One more example:
    Full error message. After logging in go to Medication Management....
  15. Ray


    I just used fiddler and pulled up on my browser. Then I logged in. I received a lot of 404 errors which is fairly straight forward. It is looking or calling for something and it cannot find it. Is it suppose to call on an external web service or some kind of database object? I'm really not sure, but I suggest you use fiddler to help you troubleshoot your application and you run through it. You will know more on what your site is doing when you call on it and Fiddler gives you a real time report with the http calls. This should help you narrow down what your application is looking for.
  16. Well, I just run fiddler. Yes, It cannot find the web service, and this is my point.
    Web service file is there, you can see it in my web directory under /Services...

    Also, did not answer my question if MVC3 installed on that server?
    Application is working fine on two other servers where MVC3 has been installed...

    My guess is that /Service directory can not be found be cause I don't have a controller for this directory, but files are there:
  17. Ray


    I'm getting errors when I try to call on your .asmx pages. Are you sure you uploaded all the necessary files/assemblies in your application Bin folder. Base of the error, it is not able to find those assemblies.
  18. I have the same code base as here:
    You can not call those services from the browser directly, you need special parameters to pass.

    the same service is running here and it is also working.... (same code base)

    You still did not answer my question about MVC3 installation on that server.

    And again back to previous question, original error is that it cannot find file specified which is there and you can see it... this is why i need to know if MVC3 is installed
  19. Ray


    I can't comment on because it cannot check the server since I have no access to it. But the error I get when I call on your web service is a missing assembly error not some kind of parser error.
    I really don't know what to tell you since everything is pointing back to your web service. I can only suggest you focus your troubleshooting and efforts there. Maybe create another web service and call it from there. Creating something simple may help you see a better overall picture.

    Lastly I suggest you do not compare the two sites because they are both on different servers. You maybe over looking something such as adding a reference. The other server may have an assembly registered in their GAC where as we may not, so holding on to the perception that their is nothing wrong with your code because the other site works will only become an obstacle to seeing the truth. Rather view this problem as its own separate problem and do not compare it with anything else. You may start seeing something that you were unable to see before.
  20. OK
    Please answer this question:
  21. Ray


    The MVC asseblies itself is not installed on the servers GAC, however it is Bin deployable and you should be able to upload the assemblies in your applications Bin folder and have your web application reference it from there.
  22. Does that mean that I've to upload all MVC3 assemblies 25MB or more?
  23. Ray


    I'm not quite sure if the MVC assemblies are actually 25 MB or more but yes, the MVC assemblies should be uploaded to your applications Bin folder.
  24. Deploying MVC 3 (.NET 4)

    I decided to give .NET 4 + MVC 3 + Winhost a try. I had to make sure the following files were in my bin folder for a simple "hello world" to work

    • System.Web.WebPages.Razor.dll
    • System.Web.WebPages.dll
    • System.Web.WebPages.Deployment.dll
    • System.Web.Mvc.dll
    • System.Web.Helpers.dll
    • Microsoft.Web.Infrastructure.dll

    I found those files here
    C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\Assemblies

    Also check out this post

    I am more than sure MVC 3 will be added to the GAC at one point, right?!?!? Right!?
  25. Alternative

    If you are using VS2010 SP1

    You can also right click on the project and select "Add Deployable Dependencies". This step should add all the stuff below..

  26. Ray


    Thnx for that tit bit.

Share This Page