Formula Startups Use To Make Billions


Quartz.Net Example

using System;
using System.Collections.Generic;
using Quartz;
using Quartz.Impl;

namespace Quartz1
    class Program
        static void Main(string[] args)
            // construct a scheduler factory
            ISchedulerFactory schedFact = new StdSchedulerFactory();

            // get a scheduler, start the schedular before triggers or anything else
            IScheduler sched = schedFact.GetScheduler();

            // create job
            IJobDetail job = JobBuilder.Create<SimpleJob>()
                        .WithIdentity(“job1”, “group1”)

            // create trigger
            ITrigger trigger = TriggerBuilder.Create()
                .WithIdentity(“trigger1”, “group1”)
                .WithSimpleSchedule(x => x.WithIntervalInSeconds(5).RepeatForever())

            // Schedule the job using the job and trigger
            sched.ScheduleJob(job, trigger);


    /// <summary>
    /// SimpleJOb is just a class that implements IJOB interface. It implements just one method, Execute method
    /// </summary>
    public class SimpleJob : IJob
        void IJob.Execute(IJobExecutionContext context)
            //throw new NotImplementedException();
            Console.WriteLine(“Hello, JOb executed”);

Source: http://hammadk.com/quartz-net-working-example/


Web Deploy 3.5 server dependencies

Using Web Deploy 3.5 from Visual Studio 2012 including SQL scripts? Make sure you have these installed on the server:

Use Web Platform Installer to install:

  1. Microsoft SQL Server 2012 Data-Tier Application Framework
  2. SQL Server 2012 Transact-SQL ScriptDom
  3. SQL Server System CLR Types 11.0

If not you’ll get dac provider errors when deploying:



Configure SQL Server 2008 Express for Remote Connections

Enable SQL Server to Accept Remote Connections

In SQL Management Studio on the server, right click the server instance [machinename]\SQLEXPRESS and click Properties. In the left pane, click Connections, and check Allow Remote Connections to this server.

Create Firewall Rules
First we need to create two firewall rules: One for the (TCP) port that the SQL Server will use and one for the (UDP) port that the SQL Server Browser uses.
  1. Open Server Manager. In the left pane, double click: Configuration > Windows Firewall with Advanced Security.
  2. First click, then right mouse click, Inbound Rules. Click New Rule…
  3. For Rule Type, select Port, then click Next.
  4. On Protocol and Ports ensure TCP is selected. For Specified local ports, enter 1633 then click Next.
  5. Just click Next to get through the Action and Profile screens.
  6. On Name enter SQL Server 2008 Default Port. Enter a description if you would like, then click Finish.

Now we’ll need to repeat the procedure to add an entry for port 1634 as well.

  1. In the Server Manager left pane, right mouse click Inbound Rules then click New Rule…
  2. On Rule Type select Port, then click Next.
  3. On Protocol and Ports ensure UDP is selected. On Specified local ports, enter 1634 and click Next.
  4. Once again click Next through the Action and Profile screens.
  5. On Name enter SQL Server 2008 Browser Port then enter a description if you’d like one. Click Finish.

Configure SQL Server to use port 1633

Now we need to remove the dynamic ports and tell SQL Server that you want to use port 1633 to connect to the server.

  1. Go to START > All Programs > Microsoft SQL Server 2008 R2 > Configuration Tools > SQL Server Configuration Manager
  2. In the left pane of SQL Server Configuration Manager, double click SQL Server Network Configuration.
  3. Click Protocols for (Instance Name). Make sure that TCP/IP is enabled. Right mouse click TCP/IP and select Properties.
  4. Select the IP Address tab on top of the Properties screen and scroll all the way to the bottom (IPALL).
  5. Delete the entry for the TCP Dynamic Ports.
  6. Enter 1633 for TCP Port.
  7. Click OK, then OK on the Warning message.

You need to restart the SQL Server Service for the changes to take effect.

Restart SQL Server Service

To restart the SQL server…

  1. Go to START > Administrative Tools > Services.
  2. Scroll down on the right pane and select SQL Server (Instance Name).
  3. Click on the Restart Service icon in the toolbar.

Also, while you are here, make sure that the SQL Server Browser service is started.

Verify Firewall Settings

Open a Command Prompt. Run the command:

netstat -an

Ports 1633 and 1634 should both be open and listening.

You should now be able to connect to your SQL Server remotely.




Notes: SQL Server Browser was introduced in SQL Server 2005 to replace SSRP which was introduced in SQL Server 2000, which was introduced to point SQL clients to the correct instance of SQL Server (SS) on a computer. Before that, you could only have one instance of SS on a server. Since you can setup it up so that SS gets a dynamic port every time it starts up when TCP/IP is enabled for remote connections, SQL Browser is used to help the connecting clients get the port number for the named instance the client is making the request for. The way it works is the client would send a UDP message to SS Browser, which listens on port 1434 by default, and it would  look at the server’s registry and instances of SS and respond to the client with the correct port for the connection, then the client can create the connection using that port.

Since we only have one instance of SS in our machine and we issued a static port for our machine, we don’t need the ‘routing’ mechanism that SS Browser was created for, so we can just stop that service in the server’s Services and disable the firewall rule for SS Browser, which is one less port that’s open on your server. When you connect to the server from SQL Management Studio, make sure you use the port number when you log in, so the Server name on the log in would be “xx.xx.xx.xx,1633”. With SS Browser Service stopped and the Firewall Inbound Rule disabled, you should still be able to connect.

You should also rename or disable the ‘sa’ account:


ALTER LOGIN sa WITH NAME = [myLoginName];