Print Page | Close Window

Deploying Breeze

Printed From: IdeaBlade
Category: Breeze
Forum Name: Community Forum
Forum Discription: Build rich JavaScript apps using techniques you already know
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=3658
Printed Date: 28-Mar-2024 at 8:55am


Topic: Deploying Breeze
Posted By: bizcad
Subject: Deploying Breeze
Date Posted: 24-Sep-2012 at 3:48pm
1.  I downloaded breeze-runtime-plus-0.55 (the ToDo app) and compiled on my local machine with VS2012 RTM.  It worked out of the box running in IISExpress.
 
2.  I then changed the Connnection String in Web.Config to point to a real SqlServer 2005 located on our network.  It worked.
3.  I then Published the app to a Windows 2012 running in a VM on the network as an application running on port 80.
*Publish Method: WebDeploy
*Service URL: 192.168.168.176 (the ip address of the VM)  for some reason DNS did not work with the VM name.
*Site/application: Default Web Site/ToDo
*Destination URL: http://192.168.168.176/ToDo - http://192.168.168.176/ToDo
*UserName: mydomain\nstein
*I used my password - I am a domain admin so I did not think there would be a problem with security.
The connection validated.
On the next dialog, I used the connection string from Web.Config.
On the last dialog, the Preview looked ok, so I published.
 
4.  I then went to an IE9 and hit the application.  The screen was gray with no ToDo list.  An F12 -> Network capture and refresh showed that I was getting a 404 with main.js.  So I went to the Server and checked to make sure that main.js was there and it was.  The 404 was looking for main.js in http://192.168.168.176/Scripts/main.js - http://192.168.168.176/Scripts/main.js  when the app was pointing to http://192.168.168.176/ToDo/whatever - http://192.168.168.176/ToDo/whatever . 
 
5.  I got the Sales Rep Derick on the line and he pulled in a Developer who explained that Breeze expects the app to be from the base.  He helped me delete the old app and reinstall as a new Website on port 8080.  Now when I hit 192.168.168.176:8080, the app comes up.  I do not like it.  I would prefer that I could run from within the Default Web Site.  But at least I know the problem exists.
 
6.  So I went back to VS and added a ~/ to the front of the script tag to see if that would work. 

<script data-main="Scripts/main" src="@Url.Content("~/Scripts/lib/require.js")"></script>

 
to

<script data-main="~/Scripts/main" src="@Url.Content("~/Scripts/lib/require.js")"></script>

It was a breaking change.  Now when I run from F5, the app breaks at the third line of dataservice.js

core = breeze.core,It continues to break there even if I remove the ~/.  They went off to see if they could repeat the problem and they were able to do so.  I am sure a fix will be in the next build. 

Nick Stein
9/24/2012



Replies:
Posted By: JoshO
Date Posted: 24-Sep-2012 at 4:48pm
I'm the "IT guy" and I don't code so I can't explain why things in Visual Studio happen the way they happen...but I do know that the changes you made to the index.cshtml file did produce an error during Debug in IIS Express which did not correct itself when you reverted back to this:
 <script data-main="Scripts/main" src="@Url.Content("~/Scripts/lib/require.js")"></script>
 
I was able to reproduce everthing you saw and was also able to correct the problem in Visual Studio by right-clicking the ToDo solution and performing a "Clean Solution" first and then a build. This was the only method that worked and don't ask me why ;`)
 
As to deploying the app in a nested application folder under "Default Web Site" make the following changes to the index.cshtml file assuming the app folder is named "ToDo" (in IIS only not VS!!) --
 
<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8" />
        <meta name="viewport" content="width=device-width" />
        <title>Breeze Todos</title>
        <link rel="stylesheet" href="@Url.Content("/ToDo/Content/reset.css")"/>
        <link rel="stylesheet" href="@Url.Content("/ToDo/Content/toastr.css")"/>
        <link rel="stylesheet" href="@Url.Content("/ToDo/Content/toastr-responsive.css")"/>
        <link rel="stylesheet" href="@Url.Content("/ToDo/Content/todo.css")"/>
    </head>
    <body>
        <div id="applicationHost"></div>
        <script src="@Url.Content("Scripts/lib/jquery-1.8.0.min.js")"></script>
        <script src="@Url.Content("Scripts/lib/knockout-2.1.0.js")"></script>
        <script src="@Url.Content("Scripts/lib/q.js")"></script>
        <script src="@Url.Content("Scripts/lib/toastr.js")"></script>
        <script data-main="Scripts/main" src="@Url.Content("Scripts/lib/require.js")"></script>
    </body>
</html>
 
The tricky part is the css files are relative to the root of the site but not the Scripts which are relative to the application root.
Stuff like this keeps me employed!
 


Posted By: bizcad
Date Posted: 28-Sep-2012 at 2:15pm
I downloaded the newest version of everything IdeaBlade-Breeze-4c7684d today at home on my Windows 8 Machine running VS2012 Premium. After unzipping the file in my Downloads Folder, I copied it into a new folder in Visual Studio 2012\Projects and used Windows Explorer to unset the folder as read only. I then changed permissions, adding Everyone, and giving full control.

1. I opened the ToDo app in VS.
2. Made sure the Allow NuGet to Download was checked and Rebuilt the Project.
3. F5 launched the app and I did some minor testing. Everything worked.
4. The Todo.sdf was created in the AppData folder and I was able to look at the database.




Print Page | Close Window