Windows 2012 Hosting - MVC 6 and SQL 2014 BLOG

Tutorial and Articles about Windows Hosting, SQL Hosting, MVC Hosting, and Silverlight Hosting

Crystal Report Hosting :: How to Fix Unable to Cast COM Object of Type ‘ReportSourceClass’ to Interface Type ‘ISCRReportSource’

clock March 20, 2019 08:31 by author Jervis

When creating or printing a report using Crystal Reports, including printing reports to printer or generating reports in Acrobat PDF format, the following error on Crystal Report Windows Forms Viewer may occur and no report is generated or created.

System.InvalidCastException: Unable to cast COM object of type 'CrystalDecisions.ReportAppServer.Controllers.ReportSourceClass' to interface type 'CrystalDecisions.ReportAppServer.Controllers.ISCRReportSource'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{98CDE168-C1BF-4179-BE4C-F2CFA7CB8398}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).
   at System.StubHelpers.StubHelpers.GetCOMIPFromRCW(Object objSrc, IntPtr pCPCMD, IntPtr& ppTarget, Boolean& pfNeedsRelease)
   at CrystalDecisions.ReportAppServer.Controllers.ReportSourceClass.Refresh()
   at CrystalDecisions.ReportSource.EromReportSourceBase.Refresh(RequestContext reqContext)
   at CrystalDecisions.CrystalReports.Engine.FormatEngine.Refresh(RequestContext reqContext)
   at CrystalDecisions.CrystalReports.Engine.ReportDocument.Refresh()
   at CrystalDecisions.CrystalReports.Engine.Table.SetDataSource(Object val, Type type)
   at CrystalDecisions.CrystalReports.Engine.ReportDocument.SetDataSourceInternal(Object val, Type type)
   at CrystalDecisions.CrystalReports.Engine.ReportDocument.SetDataSource(DataTable dataTable)
   at Portal_Inkaso.frIndex.OrderTT()
   at Portal_Inkaso.frIndex.Order1()
   at Portal_Inkaso.frIndex.llbOrder_LinkClicked(Object sender, LinkLabelLinkClickedEventArgs e)
   at System.Windows.Forms.LinkLabel.OnLinkClicked(LinkLabelLinkClickedEventArgs e)
   at System.Windows.Forms.LinkLabel.OnMouseUp(MouseEventArgs e)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.Label.WndProc(Message& m)
   at System.Windows.Forms.LinkLabel.WndProc(Message& msg)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

The error normally happens due to incompatibility between different version of Crystal Report or normally occurs after platform updates.

Thus, to resolve the “Unable to cast COM object of type ‘CrystalDecisions.ReportAppServer.Controllers.ReportSourceClass’ to interface type ‘CrystalDecisions.ReportAppServer.Controllers.ISCRReportSource'” issue, make sure to remove all old Crystal Report assemblies from Reference list in all projects. Then add new Crystal Reports assemblies and rebuild the application. If you’re unable to rebuild the app, add the following code in app.config/web.config to make sure <dependentAssembly> workaround as suggested by SAP:

<runtime>
  <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
    <dependentAssembly>
      <assemblyIdentity name="CrystalDecisions.CrystalReports.Engine" publicKeyToken="692fbea5521e1304" culture="neutral"/>
      <bindingRedirect oldVersion="13.0.2000.0" newVersion="13.0.3500.0"/>
    </dependentAssembly>
    <dependentAssembly>
      <assemblyIdentity name="CrystalDecisions.ReportSource" publicKeyToken="692fbea5521e1304" culture="neutral"/>
      <bindingRedirect oldVersion="13.0.2000.0" newVersion="13.0.3500.0"/>
    </dependentAssembly>   
    <dependentAssembly>
      <assemblyIdentity name="CrystalDecisions.Shared" publicKeyToken="692fbea5521e1304" culture="neutral"/>
      <bindingRedirect oldVersion="13.0.2000.0" newVersion="13.0.3500.0"/>
    </dependentAssembly>
    <dependentAssembly>
      <assemblyIdentity name="CrystalDecisions.Web" publicKeyToken="692fbea5521e1304" culture="neutral"/>
      <bindingRedirect oldVersion="13.0.2000.0" newVersion="13.0.3500.0"/>
    </dependentAssembly>
    <dependentAssembly>
      <assemblyIdentity name="CrystalDecisions.Windows.Forms" publicKeyToken="692fbea5521e1304" culture="neutral"/>
      <bindingRedirect oldVersion="13.0.2000.0" newVersion="13.0.3500.0"/>
    </dependentAssembly>
    <dependentAssembly>
      <assemblyIdentity name="CrystalDecisions.ReportAppServer.ClientDoc" publicKeyToken="692fbea5521e1304" culture="neutral"/>
      <bindingRedirect oldVersion="13.0.2000.0" newVersion="13.0.3500.0"/>
    </dependentAssembly>
    <dependentAssembly>
      <assemblyIdentity name="CrystalDecisions.ReportAppServer.CommonControls" publicKeyToken="692fbea5521e1304" culture="neutral"/>
      <bindingRedirect oldVersion="13.0.2000.0" newVersion="13.0.3500.0"/>
    </dependentAssembly>
    <dependentAssembly>
      <assemblyIdentity name="CrystalDecisions.ReportAppServer.CommonObjectModel" publicKeyToken="692fbea5521e1304" culture="neutral"/>
      <bindingRedirect oldVersion="13.0.2000.0" newVersion="13.0.3500.0"/>
    </dependentAssembly>
    <dependentAssembly>
      <assemblyIdentity name="CrystalDecisions.ReportAppServer.Controllers" publicKeyToken="692fbea5521e1304" culture="neutral"/>
      <bindingRedirect oldVersion="13.0.2000.0" newVersion="13.0.3500.0"/>
    </dependentAssembly>
    <dependentAssembly>
      <assemblyIdentity name="CrystalDecisions.ReportAppServer.CubeDefModel" publicKeyToken="692fbea5521e1304" culture="neutral"/>
      <bindingRedirect oldVersion="13.0.2000.0" newVersion="13.0.3500.0"/>
    </dependentAssembly>
    <dependentAssembly>
      <assemblyIdentity name="CrystalDecisions.ReportAppServer.DataDefModel" publicKeyToken="692fbea5521e1304" culture="neutral"/>
      <bindingRedirect oldVersion="13.0.2000.0" newVersion="13.0.3500.0"/>
    </dependentAssembly>
    <dependentAssembly>
      <assemblyIdentity name="CrystalDecisions.ReportAppServer.DataSetConversion" publicKeyToken="692fbea5521e1304" culture="neutral"/>
      <bindingRedirect oldVersion="13.0.2000.0" newVersion="13.0.3500.0"/>
    </dependentAssembly>   
    <dependentAssembly>
      <assemblyIdentity name="CrystalDecisions.ReportAppServer.ObjectFactory" publicKeyToken="692fbea5521e1304" culture="neutral"/>
      <bindingRedirect oldVersion="13.0.2000.0" newVersion="13.0.3500.0"/>
    </dependentAssembly>
    <dependentAssembly>
      <assemblyIdentity name="CrystalDecisions.ReportAppServer.Prompting" publicKeyToken="692fbea5521e1304" culture="neutral"/>
      <bindingRedirect oldVersion="13.0.2000.0" newVersion="13.0.3500.0"/>
    </dependentAssembly>
    <dependentAssembly>
      <assemblyIdentity name="CrystalDecisions.ReportAppServer.ReportDefModel" publicKeyToken="692fbea5521e1304" culture="neutral"/>
      <bindingRedirect oldVersion="13.0.2000.0" newVersion="13.0.3500.0"/>
    </dependentAssembly>
    <dependentAssembly>
      <assemblyIdentity name="CrystalDecisions.ReportAppServer.XmlSerialize" publicKeyToken="692fbea5521e1304" culture="neutral"/>
      <bindingRedirect oldVersion="13.0.2000.0" newVersion="13.0.3500.0"/>
    </dependentAssembly>
  </assemblyBinding> 
</runtime>

Replace the values for newVersion and oldVersion accordingly based on your deployment version.

If the Crystal Reports error only happens on some computers, but not on others, make to to update and deploy same versions of Crystal Reports to all workstations.

Best Crystal Report Hosting?

If you are looking for Crystal Report hosting solution, please kindly visit our site at http://www.asphostportal.com 



Windows 2016 Hosting :: How to Setup Windows Server 2016 with Static IP

clock January 29, 2019 08:00 by author Jervis

If you are setting up Windows Server 2016 as a domain controller or as any other production server function in your network it is recommended that you set it up with a static IP address. This is a quick how to guide on how to do that.

Note: you need an administrator account on the server to set your Windows 2016 server with a static IP address 

Login to your Windows 2016 server, and click on the Start button, and then click on the Control Panel:


Then click on View network status and tasks under the Network and Internet applet:



Then click on Change adapter settings on the left menu:



then right-click on your network connection, and select Properties:



Select Internet Protocol Version 4 (TCP/IPv4) and then click on Properties:



Enter the IP address you want to assigned to this server, the Network Mask, Default Gateway, and the DNS IP address:



Click  OK and then reboot the server.



IIS Hosting :: Tips to Monitor Your IIS Performance

clock December 21, 2018 08:03 by author Jervis

Need help on how to monitor IIS? This guide covers how to cover the basics including HTTP ping checks, IIS Application Pools, and important Windows Performance Counters. We also take a look at how to use an application performance management system to simplify all of this and get more advanced IIS performance monitoring for ASP.NET applications.

From Basics to Advanced IIS Performance Monitoring:

  • Ensuring your IIS Application is running
  • Windows performance counters for IIS & ASP.NET
  • Advanced IIS performance monitoring for ASP.NET

How to Monitor if Your IIS Application is Running

The first thing you want to do is setup monitoring to ensure that your application is running.

Website Monitor via HTTP Testing

One of the best and easiest things you can do is set up a simple HTTP check that runs every minute. This will give you a baseline to know if your site is up or down. It can also help you track how long it takes to respond. You could also monitor for a 200 OK status or if the request returns specific text that you know should be included in the response.

Monitoring IIS via a simple HTTP check is also a good way to establish a basic SLA monitor. No matter how many servers you have, you can use this to know if your web application was online and available.

Here is an example of one of our HTTP checks we use against Elasticsearch to help with monitoring it. We do this via Retrace; you could also you tools like Pingdom. In this example, we receive alerts if the number_of_nodes is not what we are expecting or if it doesn’t find an HTTP status of 200 OK.

Ensure Your IIS Application Pool is Running

If you have been using IIS very long, you have probably witnessed times when your application mysteriously stops working. After some troubleshooting, you may find that your IIS Application Pool is stopped for some reason, causing your site to be offline.

Sometimes an IIS Application Pool will crash and stop due to various fatal application errors, issues with the user the app pool is running under, bad configurations, or other random problems. It is possible to get it into a state where it won’t start at all due to these type of problems.

It is a good best practice always to monitor that your IIS Application Pool is started. It runs as w3wp.exe. Most monitoring tools have a way to monitor IIS Application Pools. Our product, Retrace, monitors them by default.

One weird thing about app pools is they can be set to “Started” but may not actually be running as w3wp.exe if there is no traffic to your application. In these scenarios, w3wp.exe may not be running, but there is no actual problem. This is why you need to monitor it via IIS’s status and not just look for w3wp.exe to be running on your server.

Recommended Performance Counters for IIS Monitoring

One of the advantages of using IIS as a web server is all of the metrics available via Windows Performance Counters. There is a wide array of them available between IIS, ASP.NET and .NET. For this guide on IIS performance monitoring, I am going to review some of the top Performance Counters to monitor.

System/Process Counters

  • CPU %: The overall server and CPU usage for your IIS Worker Process should be monitored.
  • Memory: You should consider tracking the currently used and available memory for your IIS Worker Process.

IIS Performance Counters

  • Web Service – Bytes Received/Sec: Helpful to track to identify potential spikes in traffic.
  • Web Service – Bytes Sent/Sec: Helpful to track to identify potential spikes in traffic.
  • Web Service – Current Connections: Through experience with your app you can identify what is a normal value for this.

ASP.NET Performance Counters

  • ASP.NET Applications – Requests/Sec: You should track how many requests are handled by both IIS and ASP.NET. Some requests, like static files, could only be processed by IIS and never touch ASP.NET.
  • ASP.NET Applications – Requests in Application Queue: If this number is high, your server may not be able to handle requests fast enough.
  • .NET CLR Memory – % Time in GC: If your app spends more than 5% of its time in garbage collection, you may want to review how object allocations are performed.

ASP.NET Error Rate Counters

  • .NET CLR Exceptions – # of Exceps Thrown: This counter allows you track all .NET exceptions that are thrown even if they are handled and thrown away. A very high rate of exceptions can cause hidden performance problems.
  • ASP.NET Applications – Errors Unhandled During Execution/sec: The number of unhandled exceptions that may have impacted your users.
  • ASP.NET Applications – Errors Total/Sec: Number of errors during compilations, pre-processing and execution. This may catch some types of errors that other Exception counts don’t include.

You should be able to monitor these Windows Performance Counters with most server monitoring solutions.

Note: Some Windows Performance Counters are difficult to monitor because of the process name or ID changes constantly. You may find it hard to monitor them in some server monitoring solutions due to this.

Advanced IIS Performance Monitoring for ASP.NET

Some application monitoring tools, like Retrace, are designed to provide holistic monitoring for your ASP.NET applications. All you have to do is install them, and they can auto-detect all of your ASP.NET applications and automatically start monitoring all the basics. Including key Performance Counters and if your IIS Site and Application Pool are running.

Retrace also does lightweight profiling of your ASP.NET code. This gives you code-level visibility to understand how your application is performing and how to improve it.



OWIN Hosting :: Introduction about OWIN

clock November 12, 2018 07:34 by author Jervis

Introduction

If you look at the current web stacks in open-source, it is fast evolving with wide-range of capabilities getting added day by day.  On the other hand, Microsoft too is constantly working to update its web application stack and released many new framework components. Though Microsoft’s Asp.Net is very mature framework, it had lacked some basic qualities like portability, modularity and scalability which the web stacks in Open Source communities were offering. This had led to the development of OWIN, a specification how an Asp.Net application and hosting servers has to be built to work without any dependency on each other and with minimal runtime packages. By implementing OWIN specification, Asp.Net can become more modular, have better scalability, it can be easily ported to different environments, and thus making it competitive with its open source counterparts. Besides this, it is also aimed to nurture the .net open source community participation for its framework and tooling support.

OWIN

OWIN stands for Open Web Interface for .Net. It is a community-owned specification (or standard) and not a framework of its own. OWIN defines an interface specification to de-couple webserver and application using a simple delegate structure. We will discuss more about this delegate later in this article. Now, let’s take a closer look at classic Asp.Net framework’s design issues in detail and how OWIN tries to mitigate it.

ASP.Net - Webserver Dependencies

Asp.Net framework is strongly dependent on IIS and its capabilities, so it can be hosted only within IIS. This has made the portability of Asp.Net application an impossible task. In particular, Asp.Net applications are basically build upon the assembly called System.Web which in turn heavily depends on IIS for providing many of the web infrastructure features like request/response filtering, logging, etc.

System.Web assembly also includes many default components that are plugged into the Http pipeline regardless of its usage in the application. This means there are some unwanted features that are executed in the pipeline for every request which degrades the performance. This has made the current open source counter-parts like NodeJs, Ruby, etc. perform way better than Asp.Net framework.

To remove these dependencies, to make it more modular and to build a loosely coupled system, the OWIN specification is built. In simple terms, OWIN removes Asp.Net application dependency on System.Web assembly at first place. That being said, OWIN is not designed to replace entire Asp.Net framework or IIS as such, thus when using OWIN model we are still going to develop an Asp.Net web application in the same way we were doing all these days but with some changes in infrastructure services of Asp.Net framework.

The other major drawback of System.Web assembly is it is bundled as part of .Netframework installer package. This has made the delivery of updates and bug-fixes to Asp.Net components a difficult and time consuming task for the Microsoft’s Asp.Net team. So, by removing the dependency with System.Web assembly, Microsoft is now delivering its owin web stack updates faster through its Nuget package manager.

Implementing OWIN

As I said before, OWIN is not an implementation by itself. It just defines a simple delegate structure commonly called as Application Delegate or AppFunc designed for the interaction between webserver and application with less dependency. AppFunc delegate signature below.

Func<IDictionary<string, object>, Task> 

This delegate takes a Dictionary object (IDictionary<string, object>) as a single argument called Environment Dictionary and it returns a Task object. This Dictionary object is mutable, meaning it can be modified further down the process. All applications should implement this delegate to become OWIN complaint.

In an OWIN deployment, the OWIN host will populate the environment dictionary with all necessary information about the request and invoke it. This means it is the entry point to the application, in other words, it is where the applications startup/bootstrap happens. Hence, this is called the Startup class. The application can then modify or populate the response in the dictionary during its execution. There are some mandatory key/values in the environment dictionary which the host will populate before invoking application.

Below are the components of Owin-based application that makes this happen. From OWIN spec,

  • Server — The HTTP server that directly communicates with the client and then uses OWIN semantics to process requests. Servers may require an adapter layer that converts to OWIN semantics.
  • Web Framework — A self-contained component on top of OWIN exposing its own object model or API that applications may use to facilitate request processing. Web Frameworks may require an adapter layer that converts from OWIN semantics.
  • Web Application — A specific application, possibly built on top of a Web Framework, which is run using OWIN compatible Servers.
  • Middleware — Pass through components that form a pipeline between a server and application to inspect, route, or modify request and response messages for a specific purpose.
  • Host — The process an application and server execute inside of, primarily responsible for application startup. Some Servers are also Hosts.

Building an OWIN complaint application

To be OWIN complaint, our Asp.Net application should implement the application delegate AppFunc. With current set of framework components, we also need the actual OWIN implementation for host, asp.net application and infrastructure service components. So, building Owin complaint application is not just implementing AppFunc delegate alone it also requires other components. Here comes the need of the Project Katana, which is Microsoft’s own implementation of this specification.

The Asp.Net's infrastructure services like Authentication, Authorization, routing services and other request/response filtering has to be done by OWIN middleware pass-through components to prevent its dependency with IIS. These middleware components resembles the Http modules in the traditional Asp.Net pipeline. They are called in the same order they are added in the Startup class similar to HttpModule events subscription in classic Asp.Net application object(Global.asax). To recall, Owin’s AppFunc delegate implementation in our application is commonly called as Startup class. We will understand it better when we build our first application.

Project Katana has evolved so much after its initial release and it is now fully incorporated into the newest version of Asp.Net called Asp.Net Core. Next section will provide us a brief history of OWIN implementation from Project Katana to Asp.Net Core releases.

Project Katana to Asp.Net Core

Project Katana is Microsoft’s first own implementation of OWIN specification and it is delivered as Nuget packages. Developers can include these packages from Nuget and start working.

Microsoft planned for Asp.Net vNext, the next version after Asp.Net 4.6 with full support of OWIN and thus Project Katana was slowly retiring. Note – Any project implementation with Katana libraries will continue to work as expected.

.Net Core 1.0 is another implementation of .NetFramework. .Net Core is a portable, open-source, modular framework and it is re-built from scratch with new implementation of CLR. The Asp.Net vNext, the next version of Asp.Net was renamed as Asp.Net 5.0 and is capable of running on .Net Core framework and latest .Net framework 4.6.2

Asp.Net 5.0 was renamed to Asp.Net Core since this framework was re-written from scratch and Microsoft felt the name was more appropriate. Asp.Net Core is delivered as Nuget packages and it will run on both .Net Core 1.0 and .NetFramework 4.5.1+ frameworks. So, the latest version of Asp.Net is now officially called as Asp.Net Core.

Though OWIN and Project Katana was released years ago, there were lots of updates happened to its implementation all these days. Hope this article helped you understand the current status and start the learning process of building Owin-based application.



ASP.NET MVC 6 Hosting - ASPHostPortal :: Creating Custom Controller Factory ASP.NET MVC

clock February 20, 2016 00:01 by author Jervis

I was reading about “Control application behavior by using MVC extensibility points” which is one of the objectives for the 70-486 Microsoft certification, and it was not clear to me, the explanation provided. So I decided to write about it to make clear for me, and I hope this help you as well.

An ASP.NET MVC application contains the following class:

public class HomeController: Controller
{
   public HomeController(Ilogger logger)//notice the parameter in the constructor
   { 

   }
}

This throw an error with the DefaultControllerFactory see image below.

The application won’t be able to load the Home controller because it have a parameter. You need to ensure that Home Controller can be instantiated by the MVC framework. In order to accomplish this we are going to use dependency injection.

The solution is to create a custom controller factory.

It calls the default constructor of that class. To have the MVC framework create controller class instances for constructors that have parameters, you must use a custom controller factory. To accomplish this, you create a class that implements IControllerFactory and implement its methods. You then call the SetControllerFactory method of the ControllerBuilder class to an instance of your custom controller factory class.

Create the CustomControllerFactory that inherit from IControllerFactory:

public class CustomControllerFactory : IControllerFactory
   { 

       public CustomControllerFactory()
       {
       }  


       public IController CreateController(System.Web.Routing.RequestContext requestContext, string controllerName)
       {
            ILogger logger = new DefaultLogger();
       var controller = new HomeController(logger);
       return controller;
       } 

       public System.Web.SessionState.SessionStateBehavior GetControllerSessionBehavior(System.Web.Routing.RequestContext requestContext, string controllerName)
       {
            return SessionStateBehavior.Default;
       } 

       public void ReleaseController(IController controller)
       {
           var disposable = controller as IDisposable;
           if (disposable != null)
           {
               disposable.Dispose();
           } 

       }
   }

You can implement the CreateController() method with a more generic way, using reflection.

public class CustomControllerFactory : IControllerFactory
{
    private readonly string _controllerNamespace;
    public CustomControllerFactory(string controllerNamespace)
    {
        _controllerNamespace = controllerNamespace;
    }
    public IController CreateController(System.Web.Routing.RequestContext requestContext, string controllerName)
    {
        ILogger logger = new DefaultLogger();
        Type controllerType = Type.GetType(string.Concat(_controllerNamespace, ".", controllerName, "Controller"));
        IController controller = Activator.CreateInstance(controllerType, new[] { logger }) as Controller;
        return controller;
    }
}

Set your controller factory in Application_Start by using SetControllerFactory method:

protected void Application_Start()
       {
           AreaRegistration.RegisterAllAreas();
           GlobalConfiguration.Configure(WebApiConfig.Register);
           FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
           RouteConfig.RegisterRoutes(RouteTable.Routes);
           BundleConfig.RegisterBundles(BundleTable.Bundles); 

           ControllerBuilder.Current.SetControllerFactory(typeof(CustomControllerFactory));
       }

This could be one of the objective of the Microsoft certification exam 70-486, more specific for “Develop the user experience”, sub-objective “Control application behavior by using MVC extensibility points”.

Hope this helped you to understand how to do dependency injection in controllers with MVC.

 

 



SQL 2014 Hosting - ASPHostPortal :: Make Your SSAS Works Like a Private Jet!

clock December 10, 2015 19:54 by author Jervis

SQL Server Analysis Services (SSAS) Tabular is a popular choice as an analytical engine for many customers. With its state-of-the-art compression algorithms, multi-threaded query processor and in-memory capabilities, SSAS Tabular can provide super quick access to data by reporting client applications. However, as a consultant, I have been called by many clients to resolve slow query performance when accessing data from SSAS Tabular models. My experiences have taught me most, if not all, of the performance issues can be resolved by taking care of the following five subject areas. 

Estimate Current Size and Growth Carefully

Tabular models compress data really well and on an average, you can expect to see 10x the compression rates (though it can be much more or less depending on the cardinality of your data). However, when you are estimating the size of your model as well as future growth, a rough figure like this is not going to be optimal. If you already have data sitting in a data warehouse, import a subset of that data — say a month — to find the model size for that and then extrapolate the value based on the required number of rows / years as well as the number of columns. If not, try to at least get a subset of the data from the source to find the model size. There are tools like BISM Memory Report and Vertipaq Analyzer that can further help in this process.

It is also important to record the number of users who will be accessing the system currently as well as the estimated growth for the number of users.

Select or Upgrade Hardware Appropriately

Everyone knows SSAS Tabular is a memory intensive application, and one major issue I have seen is only the RAM is considered when hardware selections are made. However, just focusing on the RAM is not enough and there are a lot of other variables. Suppose all the other variables are constant and there is an unlimited budget, these are the recommendations:

CPU Speed – The faster, the better, will help in computing results faster especially when there is a bottleneck on the single-threaded formula engine.

CPU Cores – In theory, the more the better as it helps in managing concurrent user loads. However, in reality, a rise in the number of cores usually corresponds to a decrease in the CPU speed due to management overload. So a balanced approach has to be taken when determining the CPU Cores and Speed. Also, licensing cost increases with the number of cores for many software.

CPU Sockets – The lesser, the better as SSAS Tabular is not NUMA aware till SQL 2014. However, this is expected to change in SQL 2016 where some NUMA optimization has been made. For large tabular models, it might be a challenge to go single socket as the amount of RAM that can be supported on a system will depend on the CPU sockets.

CPU Cache – The more, the better. Retrieving data from CPU caches are 10-100x faster than retrieving data from RAM.

CPU Architecture – The newer, the better due to the hardware performance optimizations. For eg, Intel Xeon processors with Haswell architecture is always going to be faster than Sandy architecture keeping all other variables constant.

Amount of RAM – Should have at least 2.5x the model size, if the model is going to be processed on the same server. The amount of RAM can be lesser in cases of certain scale out architectures where the model is processed in a separate server.

RAM Speed – The faster, the better (yes, RAMs have speed too!) This is very important for a memory-bound application like Tabular and should always go for the faster speeds, if budget allows.

Storage – Not important at all as it does not have any effect on query performance. However, if budget allows, it might not be a bad idea to get faster storage like SSDs, as that will help in maintenance related activities like backup, storage or even getting the tabular model online faster when the service is restarted. Apart from this, there are other factors also like network latency, server architecture (scale out), etc that have to be considered, but depending on the budget and specific customer requirements, a balanced approach will have to be made.

Design the Data Model Properly

Tabular is really good at performance and in the case of small models, is extremely forgiving in terms of bad design. However, when the amount of data grows, performance problems begin to show up. In theory, you will get the best performance in SSAS tabular if the entire data is flattened into a single table. However, in reality, this would translate to an extremely bad user experience as well as a lengthy and expensive ETL process. So the best practice is to have a star schema, generally. Also, it is recommended to only include the relevant columns from the source tables, as increasing the columns will result in an increase in model size which in turn will result in slower query performances. Increase in number of rows might still be ok as long as the cardinality of the columns don’t change much.

Depending on the specific customer requirements, there could be deviations from the best practices. For e.g., we built custom aggregate tables along with the detailed fact table in the case of a very large production model for a client. The resultant measure had a conditional statement to retrieve data from the aggregate table if the detailed level dimension data was not used in the report. Since the aggregate table was only 1/10 the size of the detailed fact table, the query came out 10x times faster whenever the details were not used, which was almost 90% of the times.

Optimize the DAX Calculations

In case of small models, Tabular is extremely forgiving in terms of bad DAX code also. However, just like in the case of bad design, performance takes a hit for the worse as you increase the data, add more users, or run complex queries. DAX performance tuning is the most difficult to tune from the current list, and it is important to have a strategy for maintaining and tuning the performance. A good place to start would be the Performance Tuning of Tabular models in SSAS 2012 whitepaper.

Monitor User Query Patterns and Train Users

Once your model is in production, it is important to keep monitoring the user query patterns as well as the resources to see potential bottlenecks. Through this, you can find whether the performance issues are being caused due to inefficient DAX, bad design, insufficient resources or most importantly, whether it is just because a user is using the model inefficiently. For e.g., in one of the cases, we found out the slow performance for all users was due to a single user dumping the entire 100 GB model into spreadsheets so he could perform custom calculations on top of it. This blocked the queries for all the other users and made things really slow for them. With appropriate requirement gatherings, we ensured all the required calculations for that user were there in the model and then trained the user to use the model for his analytics.

The success of any tabular project depends on the adoption by the end users and it is needless to say the adoption would be much better if the system is fast. These 5 tips will ensure you already have a jumpstart on that journey.

Looking to Use SQL Server Analysis Services Hosting?

As this is intermediate service, you can get this SQL Server Analysis Services on our Windows Dedicated server plan. You can start from our Bundled Cloud Platinum Class to get this service running on your server. This plan has included

- Windows Server 2008/2012 license
- 2 x 2.0 Ghz Core
- 4 GB RAM --> FREE Upgrade to 8 GB RAM (Use Promo Code ‘DOUBLERAM’)
- 2 x 500 GB Storage
- 20000 GB Bandwith
- 1000 Mbps Connection speed
- 4 Static IP
- Full 24 x 7 RDP Access
- Full 24/7 Firewall Protection
- Standard ver. SQL 2008/2012
- Support MySQL db
- PLESK Control Panel
- Antivirus
- Unlimited of MSSQL dbs
- Unlimited of MySQL dbs
- FREE SmarterMail service if you register this December

Get a HUGE discount for this Christmas!! For more information, please visit our official site at http://www.asphostportal.com.



SQL 2014 Hosting - ASPHostPortal :: How to Optimize Your SQL Query

clock October 6, 2015 08:59 by author Jervis

Modern day software applications have millions of concurrent users. Development of an efficiently serviceable application requires a huge amount of effort and requires many tools and techniques. Software developers always try to improve the performance of the application by improving design, coding and database development. For database development, query optimization and evaluation techniques are playing vital parts.

Selection of required field only.

It is very important to avoid unnecessary data selection of the query. We should select a data field that we need but not all fields of the table.

SELECT login_id, pawwsord FROM tbluser  

Index

Properly created Indexes help to optimize search results. You need to better understand the databases before the selection of a better performing index. The selection of a highly used field as an index is very important.

CREATE clustered INDEX ind_login_id ON tbluser(login_id)  

Primary Key

The Primary Key is the most important index of the table. The most important thing about a Primary Key is the selection of a short and unique field. This will lead to easy access to the data records.

CREATE TABLE tbluser(
  id INT,  
  name VARCHAR(150),  
  email VARCHAR(100),  
  login_id VARCHAR(100),  
  password VARCHAR(10),  
  primary_key(id)  
)

Index unique column

The indexing of a unique column will improve searching and increase the efficiency of the database. You must have a better understanding of the data field and their utilization before indexing a unique column. The indexing of a less used column does not help improve the efficiency of the database.

CREATE INDEX ind_email ON tbluser(email)  

Select limited records

None of the user interfaces can visualize thousands of records at once. Hence there is no way to select all the records at once, so always limit the selection when you have a large number of records. Select the required data only.

SELECT id, name, email, login_id,password FROM tbluser WHERE 1 limite 10  

Selection of correct data type and length

Use the most appropriate data type and correct length of the data. The bad selection of a data type will produce bulky databases and poor performance. This will improve resource utilization of the database server.

CREATE TABLE tbluser(id INT,  
   name VARCHAR(150),  
   email VARCHAR(100),  
   login_id VARCHAR(100),  
   password VARCHAR(10)  
)  

Avoid in sub query

Always avoid use of IN sub-queries in your applications. An In sub-query will evaluate all the records of table A with table B (product of records) before selecting the required data.

SELECT login_id,name, email FROM tbluser WHERE login_id IN ( SELECT login_id FROM tbllogin_details)

One of the correct ways is to use an inner join as in the following:  

SELECT login_id,name, email FROM tbluser INNER JOIN tbllogin_details ON tbluser.login_id =tbllogin_details.login_id 

Avoid NOT operator

Please avoid the usage of the NOT operator situation that the number of qualifying records are lower than unqualified records. Always use a positive operator such as LIKE, EXIST than NOT LIKE, NOT EXIST.

SELECT * FROM tbluser WHERE email NOT LIKE '%gmail%'  

The prefered way is:

SELECT * FROM tbluser WHERE email LIKE '%yahoo%'  



SQL Hosting with ASPHostPortal :: Using SQLBulkCopy and C# to Upload File

clock August 12, 2015 08:17 by author Jervis

In this article I am going to write about SQLBulkCopy and its major properties and methods. This article will give you the code for high performance transfer of rows from XML file to SQL server with SQLBulkCopy and C#.

SQLBulkCopy introduced as part of .Net framework 2.0. It is simple and easy tool to transfer complicated or simple data from one data source to other. You can read data from any data source as long as that data can be load to DataTable or read by IDataReader and transfer the data with high performance to SQL Server using SQLBulkCopy.

In real time applications every day millions of records get transferred from one data store to other. There are multiple ways to transfer the data like command prompt bcp utility of SQL Server, creating INSERT statements, creating SSIS packages and SQLBulkCopy. SQLBulkCopy gives you significant performance gain over other tools.

SQLBulkCopy Constructor

SQLBulkCopy initializes instance in four different way.

1. Accepts already open SqlConnection for destination.
2. Accepts connection string of SQLConnection. This constructor actually opens and initializes new instance of SQLConnection for destination.
3. Accepts connection string of SQLconnection and enum value of SqlBulkCopyOptions. This constructor actually opens and initializes new instance of SQLConnection for destination.
4. Accepts already opened SQLConnection and enum value of SqlBulkCopyOptions.

SqlBulkCopy bulkCopy =
            new SqlBulkCopy(destinationConnection.ConnectionString, 
                SqlBulkCopyOptions.TableLock))

BatchSize

SQLBulkCopy BatchSize is integer property with default value of 0. It decides how many rows need to be send to the server in one batch. If you do not set any value for this property or set it as 0, all the records will be send in single batch.

Following example sets BatchSize property as 50.

bulkCopy.BatchSize = 50;

ColumnMappings

SQLBulkCopy ColumnMappings is a collection of columns which needs to be map from source table to destination table's columns. You do not need to map the columns if column names are same. However it is very important to map the columns if column names are different. If matching SQLBulkCopy does not found the matching column it throws System.InvalidOperationException.

You can map the columns in different ways, giving both column names is easy and readable method.

Below code match the column OrderID from source table with columnNewOrderID of destination column.

bulkCopy.ColumnMappings.Add("OrderID", "NewOrderID");  

Data Type issue while mapping the column

SqlBulkCopy is particular about matching column DataType. Both the columns has to be of same DataType. If you have nullable columns, you explicitly have to convert such columns into desired DataType.

Below code converts Null to varchar(2) and can be mapped to any varchar(2) column of destination table.

SELECT  CAST(ISNULL(ShipRegion,'') as varchar(2))
            as ShipRegion FROM Orders

Quick note: If you are having computed columns like SUM, AVG etc. make sure it returns in expected DataType. If your destination table expects columns with decimal(15,7) you will have to explicitly convert the source column as decimal(15,7) because SUM will by default return decimal(38,7).

DestinationTableName

It sets the name of destination table. The method WriteToServer will copy the source rows to this particular table.

Below code will set the destination table as "TopOrders".

bulkCopy.DestinationTableName = "TopOrders";   

NotifyAfter and SqlRowsCopied

NotifyAfter is an integer property with default value of 0 and SqlRowsCopied is an event. The value of NotifyAfter indicates when to raise eventSqlRowsCopied.

The below code shows after processing 100 rows, event SqlRowsCopied will be executed.

bulkCopy.SqlRowsCopied +=
    new SqlRowsCopiedEventHandler(OnSqlRowsTransfer);
bulkCopy.NotifyAfter = 100;

private static void
    OnSqlRowsTransfer(object sender, SqlRowsCopiedEventArgs e)
{
        Console.WriteLine("Copied {0} so far...", e.RowsCopied);
}

WriteToServer

WriteToServer is a method which actually processes your source table data to destination table. It accepts array of DataRows or DataTable or IDataReader. With DataTable you can also specify the state of the rows that needs to be processed.

The following code will process rows from sourceData DataTable which has RowState as Added to DestinationTable.

bulkCopy.WriteToServer(sourceData, DataRowState.Added);



ASP.NET MVC 4 Hosting - ASPHostPortal :: How to Fix Could not load file or assembly DotNetOpenAuth.Core, Version=4.0.0.0

clock September 8, 2014 09:33 by author Jervis

We have seen that many of our clients experience this problem and we have also found this issue on many forums. So, we decide to write the solution on this tutorial and hope it will fix your problem.

Error Message

Could not load file or assembly 'DotNetOpenAuth.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=2780ccd10d57b246' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

The Problem

The application was actually upgraded earlier from ASP.NET MVC 3, i.e. it was not autogenerated by Visual Studio 2012. The pre-binding info in the exception was:

=== Pre-bind state information ===
LOG: User = NT AUTHORITY\NETWORK SERVICE
LOG: DisplayName = DotNetOpenAuth.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=2780ccd10d57b246
 (Fully-specified)
LOG: Appbase = file:///
LOG: Initial PrivatePath = \bin
Calling assembly : Microsoft.Web.WebPages.OAuth, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: \web.config
LOG: Using host configuration file: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Post-policy reference: DotNetOpenAuth.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=2780ccd10d57b246
LOG: Attempting download of new URL file:////DotNetOpenAuth.Core.DLL.
LOG: Attempting download of new URL file:////DotNetOpenAuth.Core/DotNetOpenAuth.Core.DLL.
LOG: Attempting download of new URL file:////DotNetOpenAuth.Core.DLL.
WRN: Comparing the assembly name resulted in the mismatch: Minor Version
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.

The key pieces of information here are at lines 3 and 7. Basically, Microsoft.Web.WebPages.OAuth needs DotNetOpenAuth.Core 4.0.0.0. Please check your DotNetOpenAuth.Core version again. Basically the problem from the different version.

Solution

1. Add these lines under the <runtime>/<assemblyBinding> section of the root Web.config:

<dependentAssembly>
                <assemblyIdentity name="DotNetOpenAuth.AspNet" publicKeyToken="2780ccd10d57b246" culture="neutral" />
                <bindingRedirect oldVersion="0.0.0.0-4.3.0.0" newVersion="4.3.0.0" />
</dependentAssembly>
<dependentAssembly>
                <assemblyIdentity name="DotNetOpenAuth.Core" publicKeyToken="2780ccd10d57b246" culture="neutral" />
                <bindingRedirect oldVersion="0.0.0.0-4.3.0.0" newVersion="4.3.0.0" />
</dependentAssembly>

2. The above solution works for other packages that ASP.NET MVC 4 depends on. For example, if you upgrade WebGrease from 1.0.0.0 to 1.3.0.0, you have to add this to the <runtime>/<assemblyBinding> section:

<dependentAssembly>
                <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral" />
                <bindingRedirect oldVersion="0.0.0.0-1.3.0.0" newVersion="1.3.0.0" />
</dependentAssembly>

 

 



Windows Server 2008/2012 Hosting :: Unmanaged Dedicated Hosting vs Managed Dedicated Hosting

clock August 6, 2014 08:34 by author Jervis

We believe that you must very familiar with this word “Managed Hosting and Unmanaged Hosting”. What is it about? When you purchase VPS/cloud/dedicated server, you will see 2 option, do you want to use managed or unmanaged hosting. In this post, we will discuss differences between Managed Hosting & Unmanaged Hosting as well as advantages and disadvantages of both. We will more focus in managed hosting.

When you’re buying a house and you have two options. You can buy a home with no strings attached, so that YOU are responsible for cleaning, landscaping, security, and maintenance; OR, you can pay a little extra and have a self-sustaining house that completes all those tasks for you. You can purchase a home that has automatic security and fire protection built in–one that cleans itself, protects itself and magically keeps the lawn and flower beds looking great without any effort on your part. Sounds nice, right?

Well, there’s a chance you might be thinking: Why would I pay extra if I know how to lock the doors, put out a fire, mop the floors, mow the lawn and plant flowers on my own?

Now, imagine you don’t know how to do ANY

of those tasks: If you have no knowledge of how to manage a home, your house will be much better off in the long run if you purchase the fully managed, self-sustaining option. This scenario is much like what small business owners face when confronted with the hosting industry. Often they don’t have the tools or know-how to manage a server on their own, and a fully managed hosting plan can help.

It is same with hosting business. If you choose unmanaged hosting, you simply rent a server from a hosting provider, and the responsibility of managing that server falls on whoever has the most IT experience at a small business.

Well, managed hosting basically provides your small business with an exclusive, out-of-the-office IT department. This type of hosting plan means that a perfectly capable team professionals monitors your dedicated server 24/7/365, keeping your site performing at it’s best at all times. If you don’t have experience to manage the server, then you need to choose this managed service. Same like our description above. Just imagine it. 

Technical Knowledge

There is no doubt on the fact that technical knowledge is a requirement when it comes to managing dedicated and others among web hosting services. However, requirement of technical knowledge is different in managed and unmanaged hosting. The first option does not need you to be an expert in server management and its sections, as one team from your web-hosting provider will be there to manage your cloud or dedicated server. Although the full list may be quite long, main responsibilities of team include server configuration, maintenance, security, sufficient upgrades, firewall services, backup services etc. In other words, once you have purchased managed web server, you do not have to be concerned about managing the technical aspect of your server. So, when you want to manage your website, you can log into the control panel and do things as you do in shared web servers.

Nevertheless, unmanaged web hosting is quite opposite in this aspect! Things that come with an unmanaged dedicated are the physical server itself and initial installation procedure. This also means that you will have to do everything else except these. The list of tasks includes software upgrades, security, frequent maintenance, etc. Thus, an unmanaged dedicated needs you to be an expert in terms of server management, in its all aspects. So, we would say that you should go for managed hosting if you want to skip hassles of server management.

Security System

When it comes to the case of security of web server, managed dedicated grabs the first price, because the team behind the web host will be more than enough to keep your server and websites secure from almost every possible threat. But, unmanaged server cannot, even if you have hired an effective team for maintenance, guarantee that much security. So, when you want to be less concerned about security section of your web server, you should choose managed dedicated with no doubt.

What is Benefits of Managed Hosting:

Security:

Hosting providers have the tools and experience to monitor and handle your security issues properly: they filter spam, scan for viruses, run security audits, configure software firewalls, and provide OS updates.

Backups:

Lost data can be detrimental and expensive for a company. In many cases a natural disaster is to blame for a significant loss of data, but a hosting provider has procedures to deal with data loss and provide secure, backed up data after such a situation occurs.

Monitoring Server:

This is the process of constantly scanning the server for any problems or irregularities, and it’s crucial for your small business. System admins will ensure network availability for your clients by constant monitoring.

Managed Storage & Database:

System admins will save you money by managing your storage needs with the help of a managed services provider, so that the amount of space needed is managed properly and scaled properly. Managing of the database is more complicated, and it’s conducted by a database admin that can effectively design the best database to meet your company’s specific needs and requirements.

Pricing

Indeed, pricing is a significant factor while choosing between managed hosting and unmanaged hosting! As you may have guessed, managed web servers cost more than unmanaged web server, as such, servers offer assistance as well as support. However, if you do not have enough technical knowledge about web servers, purchasing an unmanaged web server means purchase of a team that is capable of maintaining the server in its optimum functional condition.

Conclusion

Whether you choose unmanaged and managed hosting, you don’t need to worry to spend a lot of money as we have affordable windows cloud dedicated server that we believe it will suits your requirement. Please visit cheap cloud dedicated server price on our site. Our cheap windows cloud dedicated server start from only $18.00/month. You can choose managed or unmanaged service.



About ASPHostPortal.com

We’re a company that works differently to most. Value is what we output and help our customers achieve, not how much money we put in the bank. It’s not because we are altruistic. It’s based on an even simpler principle. "Do good things, and good things will come to you".

Success for us is something that is continually experienced, not something that is reached. For us it is all about the experience – more than the journey. Life is a continual experience. We see the Internet as being an incredible amplifier to the experience of life for all of us. It can help humanity come together to explode in knowledge exploration and discussion. It is continual enlightenment of new ideas, experiences, and passions

 photo ahp banner aspnet-01_zps87l92lcl.png

Author Link

Corporate Address (Location)

ASPHostPortal
170 W 56th Street, Suite 121
New York, NY 10019
United States

Sign in