How to fix $injector:unpr Unknown Provider in AngularJS

I have an AngularJS application with ASP.NET. When I publish the application, and host in on local IIS, I get this error.
In Web.config, in compilation tag when I set debug=”true” the application works as expected, otherwise, I get this issue, so I assume that this is minification problem.
I did my research, it turned out that strict dependency injection should be used (and it is).
Now, I have no more ideas how to approach this problem.
Here is a section of code that error points out.

var betApp = angular.module("betApp", [
    "ngRoute",
    "PubSub",
    "ngMap",
    "ngSanitize",
    "angularFileUpload",
    "angular-md5"
])

The controller:

betApp.controller("MainCtrl", MainCtrl);

MainCtrl.$inject = ["$scope", "$route", "PubSub", "$location", "$rootScope", "$timeout", "$http", "configuration", "StaticService"];

function MainCtrl($scope, $route, pubSub, $location, $rootScope, $timeout, $http, configuration, StaticService) {
   //controller logic
}

The service:

betApp.factory("StaticService", StaticService);

function StaticService() {
    // service logic
    return{
        flag: true
    }
}

And the error itself: Unknown provider: StaticServiceProvider <- StaticService <- MainCtrl