Failure to Deploy

Discussion in 'General troubleshooting' started by ccosborn, Jun 7, 2011.

  1. I followed the procedure at http://support.Winhost.com/KB/a619/how-to-configure-the-aspnet-membershiproles-provider.aspx and used VS2010's website template for Razor.

    #1. When you try to run this locally, you will get an error for WebSecurity.InitializeDatabaseConnection("LocalSqlServer", "UserProfile", "UserId", "Email", true); This statement does not like "Initial Catalog=" in the connection string. OK, so don't run it locally.

    #2. To see your website you will need to add (to the web.config)

    <system.webServer>
    <defaultDocument>
    <files>
    <add value="Default.cshtml" />
    </files>
    </defaultDocument>
    </system.webServer>

    #3 Now, you will experience the problem of your links don't work because "About" has to be changed to About.cshtml". Go figure.

    #4 Now try to register. No can't find "~Account/Register". Try making it "~Account/Register.cshtml". No that does not work either. OK, forget registration.

    #4 Now try to use the database -- put in the Default.cshtml the statements

    var db = Database.Open("LocalSqlServer");
    var selectQueryString = "SELECT * FROM dbo.webpages_Membership ORDER BY UserId";
    var data = db.Query(selectQueryString);


    no way, that last statement throws an exception. "Unable to find the requested .Net Framework Data Provider. It may not be installed." OK, no database either.


    Anyway, the support group says you guys can help. I know that there will be the "What are you trying to do, exactly?" type questions and people wanting to get a screen shot or get all of the source code. All of the code is template (and it appears to be the same with WebMatrix/StarterSite). Well, you will get the same result if you follow the procedures.
     
    Last edited by a moderator: Oct 14, 2015
  2. Last edited by a moderator: Oct 14, 2015
  3. Razor does run on Winhost. But as you've seen elsewhere, it can be a problematic technology to implement.
     
    Last edited: Oct 14, 2015
  4. But Hank,

    Isn't that just in MVC?

    There are two ways to run Razor one is in MVC the other is a Web Pages website.
     
  5. Ray

    Ray

    Razor is a separate technology and from what I can see and all the testing I've done on it, certain files needs to be uploaded. These are dll files and it needs to be upload to the Bin folder. What makes it worst is if you use SQL CE v4, more DLL files will need to be uploaded so that the web application can connect and communicate with the SQL CE v4 db file.
     
  6. Razor is a view engine for MVC.
     
  7. ASP.NET VS2010 Failure to Deploy

    I created a VS2010 project website using the asp.net 4 template. I was able to run the machine locally connected to the Winhost website and add new users and log on as a registered user.

    (The Winhost database was previously configured with the aspnet_regsql.exe)

    Using web deploy, everything goes successfully. But it can not log on - it throws an exception. It can not find the resource \account\login.

    Does anyone have experience in using and deploying the VS2010 web project templates?

    Try it -- www.apaicorp.com and then try to login.
     
    Last edited by a moderator: Oct 14, 2015
  8. I dumped MVC (I couldn't get it to work, even with the help of the asp.net forum, though they are still at it) and selected the ASP.NET 4 template.

    The nice thing about this project I was able to get the localhost to run the website and use the Winhost database for roles/membership -- it was great. I could add members, log in as registered members, etc.

    It does not work when I deploy. Since this thread is about MVC I documented the problem in a ASP.NET Failure to Deploy.

    Seems to me that all of the technologies WebMatrix/MVC/ASP.NET are all kind of tricky.
     
    Last edited by a moderator: Oct 14, 2015
  9. I was not able to get the templates for MVC or ASP.NET to ever run completely. This is all completely documented in many posts here on the subject.

    Even the people at asp.net forums were stumped with the error messages.

    After a month of support tickets and posting on the forum, there were no answers.

    I MUST try another hosting service.
     
  10. Ray

    Ray

    I really can't see what error you are referring to in this thread. So it is really difficult to actually help you or point you to the correct answer. All I can say is that MVC and Razor is fully compatible on our shared hosting environment. The biggest problem from what I see with people hosting MVC/Razor on a web server is that they did not upload all the DLL files with there application. Of course this is very misleading because if you run your Site using Visual Studio or Web Matrix everything works. This is because these IDE/Authoring tools use there own engine and automatically run the DLL/Binaries when you view it through VS or Web Matrix. But when you upload it to a web server you will realize it will not work. This is really not the servers fault. And to a great extent its really not the programmers fault either. Like I said, running your application on VS or Web Matrix to test your application is misleading. Rather a better test, is to setup your own local machine with IIS. For computers running on Vista or Windows 7, IIS is already installed on the computer, you just have to enable it and configure it. Once you have IIS running on your own personal computer, upload your web project in the root folder of IIS and call it on your browser. The standard URL to call your web site you are hosting on your computer with IIS is http://localhost
    If you do this, then you will see that the program may not necessarily work and for the most part the error message will match with the error message you will see if you upload it to our web servers without the DLL's. But if you go to Visual Studio or Web Matrix and call on the site through there you will see it pulls up correctly. Confusing isn't it?
     
  11. Look, you have done a lot of work on this and I wished you hadn't. I did a lot of work and that is the way it is supposed to be, but I did get my site to work by myself.

    The bottom line, I changed to a different host. They primarily just use web deploy and there is no uploading the "binaries" for web matrix. Everything works the same. And it all works.

    I tried with Winhost Ray, I did a lot of work for three weeks. I bought books, I went on the asp.net forums and MSDN (I am member). In your case, no one could understand why I was getting the errors. I tried every template with Winhost. It is all documented as to my "education" in your forum.

    The fact that you have to upload the binaries does make Winhost different -- I guess.

    What you say above is of course excellant documentation and you write well. Have you ever tried to do it yourself -- meaning take a ASP.NET web application template and get it up and running on Winhost and have the Logon run?

    At your competitor it is a piece of cake. Sorry, if it was so easy at Winhost and I just missed it, but I worked on this for more than three weeks with all kinds of help. Switched host and it was running in minutes. I am not confused anymore.

    Oh, this other place doesn't even need a forum.
     
    Last edited by a moderator: Oct 14, 2015
  12. You mean they don't even have a forum, which might explain why you're still hanging around here.

    No one needs a forum. Forums are provided as a courtesy and a tool. You'll find that most hosting companies that don't have forums, or any sort of place for public comment, are doing something they would rather not engage in conversation about. Or they just don't care. Either one isn't a good sign, but what can you do.

    Frankly, maintaining forums and wrangling users and spammers and the various and sundry other headaches that come along with it is a tremendous pain in the ass. I can understand why someone would choose not to deal with it, but the idea that they are somehow superior due to their lack of a forum is...something...I'm not sure what. Look up ridiculous in a thesaurus, one of those words will be appropriate.

    We want to engage in conversation, even if it's with ex-customers who just hang around to tell us how awesome their new host is. It's kind of like someone hanging around your Honda dealership and talking about their new Mini Cooper all day, so I don't really understand it, but hey, I still love you. You're tenacious, and that's a good quality. I'd want you on my team, whatever the team is doing. And I'm glad you're having a good time in the Mini Cooper. I just hope you didn't get one with that Union Jack on the top. Between you and me, those are kind of ugly.
     
  13. Hank,

    Ironically, I have to admit that I am hanging around trying to help Winhost while Winhost is trying to help me -- I don't really blame you for not believing me when I say I think you have a problem -- I am probably wrong (I thought I was making a convincing argument).

    There is no damaged party here. We are all happy. We all have better things to do.
    Let's mark this as "Answered" and move on.

    Thank You.
     
    Last edited by a moderator: Oct 14, 2015
  14. curtis

    curtis Winhost Staff

    Also, to add to this. The Microsoft Staff tested WebMatrix out on our hosting platform and it worked so they approved us as a WebMatrix-ready host.
     
  15. This newbie got MVC3/Razer/Authentication working

    Let me start by saying I'm a seasoned LAMP web-stack developer, with extensive .NET Winforms & WPF experience, but I'm an absolute newbie to the ASP.NET IIS MVC3 Razer environment.

    I signed up with Winhost yesterday to start playing in the MVC3/Razer sandbox, and yes, I too struggled to get the VS2010 MVC3 template site working when deployed. I want to thank ccosborn for posting his (/her?) experience and helping me to avoid similar frustrating pitfalls.

    Allow me to connect the dots for future newbie ASP.NET developers.

    To make MVC3/Razer work for your web application:
    After using WebDeploy, use an FTP program (i.e. FileZilla) to copy the ASP.NET assemblies referenced by your application (you can easily find these by following the path attribute of their properties panel. For instance, in my case, I needed to copy all the files found in c:\Program Files\Microsoft ASP.NET\ASP.NET MVC 3\Assemblies and c:\Program Files\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\Assemblies.) These should be copied to your WinhostAppDomain->ApplicationFolder->bin directory. (i.e. If my domain is foo.com, and I'm publishing to a subfolder called MvcApplication1, then I need to copy these files to foo.com\MvcApplication1\bin.)

    To get Authentication working:
    Use the Winhost control panel to create a new MSSql Database. Once complete you will be given the proper connection string for it (you'll need to replace the xxxxx with your password when you use it ;)). Next, you'll need to use the microsoft aspnet_regsql.exe tool to configure that database to manage ASP.NET memberships and security roles. You'll find this tool in C:\Windows\Microsoft.NET\Framework\v4.0.30319 (or whatever the latest framework is you have installed.) Double-clicking the tool will start a configuration wizard. Use it to modify the database using the connection settings you received when you created the database on Winhost. Once it's finished, the database will have the required aspnet_xxxx tables.

    You'll need to update the web.config file to use this new database. I believe the best way to do this is to modify your project's Web.Release.config file so that when you deploy to the server, the production connection string is automagically updated. Uncomment the sample <connectionStrings> transform and update it with your connection details. Assuming you used the vanilla MVC3 template like I did, your transform should look something like this:

    Code:
    <connectionStrings>
        <add name="ApplicationServices"
          connectionString="Data Source=tcp:s05.Winhost.com;Initial Catalog=DB_12345_sandbox;User ID=DB_12345_sandbox_user;Password=SomeSecretPasswordHere;Integrated Security=False;"
          xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
    </connectionStrings>
    Redeploy your site and the default template site should allow you to "register".

    I hope this helps and Good Luck to all.
     
    Last edited by a moderator: Oct 14, 2015
  16. Nice post, thanks.
     
  17. I was just wondering why the Winhost servers don't already have the MVC3 and ASP.NET WebPages DLLs loaded into the GAC?

    When I saw MVC3 support listed on the hosting page, this is what I assumed.

    Anyway, not too much of an issue - can easily copy the DLL's up as atlanticom said.
    On some machines, the Microsoft ASP.NET directory might be in Program Files (x86)\

    Also I must say I have been with Winhost for a few days and am very impressed. Has been really easy to get up and running.
     
    Last edited by a moderator: Oct 14, 2015
  18. curtis

    curtis Winhost Staff

    In some of our past hosting experience, we've seen many issues caused by installing stuff into the GAC - for example when a dll is updated, then all the apps using an older version stops working. Some vendors come out with minor version updates weekly that are all separate installs. If you are some small hosting company with one server, yeah you can install anything - but scale this out to 100s of servers and it becomes a nightmare to manage (and we do plan on having 100s of servers in the future). Using bin deploy, each site gets what they need to run their apps without reliance on the host's resources to keep up with server installs and prevents apps from breaking.
     
  19. For example there is a refresh coming in the next few days/week or so. Believe me, its much safer this way.
     
  20. Thank you atlanticom.

    While I was "running" through Winhost I did not find the complete information about doing a "WebDeploy and then a FileZilla operation". I was just passing through and it is good to see the discussion did not end with me. A very good sign that the "environment" is working.

    atlanticom and ccosborn just a couple of newbies. I am still newbieing along my merry way.
     
    Last edited by a moderator: Oct 14, 2015
  21. Update -Easier- Method to deploy MVC framework DLLs

    I found an easier method to deploy the MVC3/Razor framework dlls to the application bin directory when using the one-click deployment feature of VS2010.

    Simply right-click the project and select "Add Deployable Assemblies". Then check the "ASP.NET MVC" option and say OK.

    That will add a "_bin_deployableAssembiles" folder to your project that includes the MVC3 stack. (You can drop additional assemblies here for deployment too.)

    This info (along with more) was found here:
    http://haacked.com/archive/2011/05/25/bin-deploying-asp-net-mvc-3.aspx

    Happy Coding.
     
  22. All right! Thank you. I have been avoiding Chapter 7 and as they say, "Life is what happens to you while you are making other plans".

    In fact, even though you guys are MVC types, you have to deploy the assemblies for the other types of projects in VS2010. It apparently varies between hosting sources.

    atlanticom/Stedman thank you again.

    Coding here we come!
     

Share This Page