The requested resource does not support http method ‘POST’

After a life of web sites developed with Web Forms, now i’m working with MVC.

Not a basic MVC, but SPA apps using Angular, Breeze, Twitter Bootstrap.. an huge jump.

In the Controller folder of my solution i was thinking to create an utilities controller, in this case for the logging of javascript errors, paging utilities, and so on.

So i initially created a class as:

public class ServicesController : ApiController
	public void SubmitError(string jsRespoText, string jsstatus, string jssource)
		ExceptionUtility.LogJsExceptionFile(jsRespoText, jsstatus, jssource);

	public JsonGenResponse CreatePagerStdTable(int startRowIndex, int totalCount, int pageSize, string jsLoadDataFunName, string Filter, string QueryType)
		// this will be another post…

For the HttpGet , no problem.

When i tried from Fiddler the HttpPost method i got the error written in the subject of this post.

A Controller decorated with [BreezeController] works as POST, and it was tested.. but it uses a JObject parameter, i noticed.

The POST problem pops out when you try to use primitive (string, int..) parameters in a Web API call instead of an object.

A solution could be to use [FromBody], with this attribute WebAPI search the attribute:value in the request body.

But there is a problem : is not possible to specify more than one “[FromBody]” , so is not possible to write:

public void SubmitError([FromBody]string jsRespoText, [FromBody]string jsstatus, [FromBody]string jssource)

The solution is to create a class, in my case

public class JsErrorData
    public string jsRespoText { get; set; }
    public string jsstatus { get; set; }
    public string jssource { get; set; }


And then write the method as

public void SubmitError(JsErrorData jsObjErr)
    ExceptionUtility.LogJsExceptionFile(jsObjErr.jsRespoText, jsObjErr.jsstatus, jsObjErr.jssource);

The javascript caller:

function logJsError(responseText, status, source, callback) {
    var ajaxImpl = breeze.config.getAdapterInstance("ajax");
        type: "POST",
        contentType: "application/json;charset=UTF-8",
        url: strBaseHttp + "api/Services/SubmitError",
        data: "{'jsRespoText': '" + responseText.replace(/'/g, '') + "','jsstatus':'" + status + "','jssource':'" + source + "'}",
        success: function (html) {
        async: true

Now HttpPost is working.

Categories: .NET, JQuery, MVC, SPA

Good idea

Categories: Uncategorized

Oracle RAC Linked server in Sql 2014 64 bit

I was needing to create a linked server from SQL Server 2014 64 bit, on a pc with Windows 8.1 64 bit , to an Oracle configured in RAC (Real Application Clusters).

The RAC configuration is composed from 3 servers .

The first step is to install the Oracle software from

Here must be downloaded 64-bit ODAC 12c Release 2 ( for Windows x64 , the file because there is an guided installer.

After a while it starts then use the default choice, that is the Oracle Data Access Components which installs the Data Provider for .NET, Oracle Provider for OLEDB, Oracle Services for Microsoft Transaction Server, Oracle instant client.

Then use the Next button accepting all defaults until the end.

At the end there is a wizard for the compilation of tnsnames.ora file, but in this case we are working with a RAC and the wizard cannot manage this configuration.

After the installation is recommended to reboot, then we should see in Sql Management Studio the OraOLEDB provider listed:

By default in C:\app\studio\product\12.1.0\client_1\Network\Admin there is our TNSNAMES.ORA file

We must know the NETBIOS or the IP of the servers in RAC and the name of the Oracle instance, in our case TRAFSRV for example.

So the TNSNAMES.ORA , indicating the IP for each or our 3 RAC server, should be :

    (ADDRESS = (PROTOCOL = TCP)(HOST = = 1521))
    (ADDRESS = (PROTOCOL = TCP)(HOST = = 1521))
    (ADDRESS = (PROTOCOL = TCP)(HOST = = 1521))
     (RETRIES = 5)
     (DELAY = 3)

It should be verified that the 1521 port is opened in the firewall, in both Sql and Oracle servers.

Now we can create the linked server , for example

USE [master]
EXEC master.dbo.sp_addlinkedserver @server = N'ORAARTA33', @srvproduct=N'Oracle', @provider=N'OraOLEDB.Oracle', @datasrc=N'TRAFSRV'
EXEC master.dbo.sp_addlinkedsrvlogin @rmtsrvname=N'ORAARTA33',@useself=N'False',@locallogin=NULL,@rmtuser=N'ORACLEUSER',@rmtpassword='ORACLEUSERPWD'

In this sample ORAARTA33 is the name of the linked server, it there are no problems we should see

Categories: .NET, Oracle, SQL Server

Asp:ButtonColumn not working in Ie11

I was working to an old VB.NET web application with Visual Studio 2010 , .NET 4.0; the solution for tables uses asp:DataGrid

Until Internet Explorer 10 all ok, with Ie11 the asp:ButtonColumn inside an asp:DataGrid was not working, clicking the link nothing.

It seems that the .NET 4 framework does not work well with Ie11 , and the update to .NET 4.5 was not an option (Windows Server 2003).

With the latest updates Ie11 was still recognized as Mozilla 0.0

The solution is to add an App_Browser folder

And then inside the folder create an .browser file with this content:

  <browser id="IE11" parentID="Mozilla">
      <userAgent match="Trident\/7.0; rv:(?'version'(?'major'\d+)(\.(?'minor'\d+)?)(?'letters'\w*))(?'extra'[^)]*)" />
      <userAgent nonMatch="IEMobile" />
      <userAgent match="Trident/(?'layoutVersion'\d+)" />
      <capability name="browser" value="IE" />
      <capability name="layoutEngine" value="Trident" />
      <capability name="layoutEngineVersion" value="${layoutVersion}" />
      <capability name="extra" value="${extra}" />
      <capability name="isColor" value="true" />
      <capability name="letters" value="${letters}" />
      <capability name="majorversion" value="${major}" />
      <capability name="minorversion" value="${minor}" />
      <capability name="screenBitDepth" value="8" />
      <capability name="type" value="IE${major}" />
      <capability name="version" value="${version}" />

  <!-- Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11,0) like Gecko -->
  <browser id="IE110" parentID="IE11">
      <capability name="majorversion" match="11" />

      <capability name="ecmascriptversion" value="3.0" />
      <capability name="jscriptversion" value="5.6" />
      <capability name="javascript" value="true" />
      <capability name="javascriptversion" value="1.5" />
      <capability name="msdomversion" value="${majorversion}.${minorversion}" />
      <capability name="w3cdomversion" value="1.0" />
      <capability name="ExchangeOmaSupported" value="true" />
      <capability name="activexcontrols" value="true" />
      <capability name="backgroundsounds" value="true" />
      <capability name="cookies" value="true" />
      <capability name="frames" value="true" />
      <capability name="javaapplets" value="true" />
      <capability name="supportsCallback" value="true" />
      <capability name="supportsFileUpload" value="true" />
      <capability name="supportsMultilineTextBoxDisplay" value="true" />
      <capability name="supportsMaintainScrollPositionOnPostback" value="true" />
      <capability name="supportsVCard" value="true" />
      <capability name="supportsXmlHttp" value="true" />
      <capability name="tables" value="true" />
      <capability name="supportsAccessKeyAttribute" value="true" />
      <capability name="tagwriter" value="System.Web.UI.HtmlTextWriter" />
      <capability name="vbscript" value="true" />
Categories: .NET, Ajax, Visual Studio 2010

BI for Visual Studio 2013

Still unavailable…someday at this address.

Update 05/23 : available !

Categories: BI, SQL Server, SSIS

OData services

My previous post is half the story.

The original intent was to use Entity Framework and build an WCF data service, but with the latest EF 6.1.0 it seems that is no more possible.

Microsoft is now strongly oriented to the new OData religion: i discovered that there is a NUGet project for a bridge between WCF and EF6 in a alpha stage, and it seems abandoned from months.

I tried, but it installs an EF6 prerelease, and in every case i was not able to obtain something of working.

In my previous post i was able to create an EF model, and then i added an WCF Data Service 5.6.

But it was not working , trying to launch the .svc file i got

“The server encountered an error processing the request. See server logs for more details.”

I ended up with this code:

namespace NorthwindWeb
    [ServiceBehavior(IncludeExceptionDetailInFaults = true)]
    public class NorthwindCustomers : DataService<NorthwindEntities1>
        public static void InitializeService(DataServiceConfiguration config)
            config.UseVerboseErrors = true;
            config.SetEntitySetAccessRule("Customers", EntitySetRights.AllRead);
            config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V3;

The ServiceBehavior decoration gives detailed error infos , which was:

“The server encountered an error processing the request. The exception message is ‘Expression of type ‘System.Data.Entity.Core.Objects.ObjectContext’ cannot be used for return type ‘System.Data.Objects.ObjectContext”

It seems that i should use EntityFrameworkDataService<NorthwindEntities1> instead of DataService, but this object is apparently not available in EF6 object model or somewhere else, and i’m not the best WCF/EF expert.

I’m thinking to the ones (also me) that had written a lot of WCF code using EF…they should rewrite all? or the projects needs to be “closed”, no more NuGet updates ?

This is another case where “googling” i find that i’m not alone.

Ok , waiting for the next Microsoft change of mind (“throw away OData: is old, unsecure, blah blah.. now there is <new buzzword>”) i wrote the OData web service with Web API…sometimes i envy the COBOL programmers that are maintaining ancient software where the screens are painted with | and -.

So from Visual Studio 2013 new project ->ASP.NET Web Application

Then in the next wizard step choose the Empty template but add Web API:

This is the moment of adding via NuGet (TOOLS->NuGet Package Manager->Manage NuGet packages for Solution.. the Entity Framework and OData.


Now is recommended to clic on Updates and update all of the NuGet components:

Now if we want to add an Data Model there is still the trouble described in the previous post; so copy the sample connection string in web.config (also from the mentioned previous post) changing the name , data source, initial catalog and so on.

We still use Northwind as sample, so we add to the solution an ADO .NET Entity Data Model that in our sample we call NorthwindModel.edmx

In order to avoid mistakes , is better to leave checked the creation of a new connection string, that will be the one used:

In this sample we still use only the Customers table

With a Model Namespace = NorthwindModel

Do a Build->Rebuild all, otherwise in the next step Visual Studio complains about an error.

In the automatically generated Controllers folder (in the Visual Studio solution) right clic and add a controller:

We add “Web API2 OData with actions, using Entity Framework”.

In the next step by simply clicking on the drop downs and writing “CustomersEntity” in Controller name we can set the controller as in figure:

In the Controllers folder now we have a CustomersEntityController.cs class: Visual Studio and his template engine is so gently that is generated also an sample of code:

The commented code must be copied in WebApiConfig.cs class under the App_Start folder, so at the end we have

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Http;
using System.Web.Http.OData.Builder;
using NorthwindSvc;
namespace NorthwindSvc
    public static class WebApiConfig
        public static void Register(HttpConfiguration config)
                name: "DefaultApi",
                routeTemplate: "api/{controller}/{id}",
                defaults: new { id = RouteParameter.Optional }
            ODataConventionModelBuilder builder = new ODataConventionModelBuilder();
            config.Routes.MapODataRoute("odata", "odata", builder.GetEdmModel());

Ok, now we can launch the site.

Tipically this does nothing, complaining that a default document is not configured for the requested URL, and directory browsing is not enabled on the server.

But in CustomersEntityController.cs we can see examples of calling the web service, so if we add /odata/CustomersEntity to the browser address (for example http://localhost:11775/odata/CustomersEntity)

we get an JSON file with the records of the Customers table:

This with Google Chrome, Internet Explorer requires to download the JSON file.

Observing the generated code we can read

// GET odata/CustomersEntity(5)
public SingleResult<Customers> GetCustomers([FromODataUri] string key)
    return SingleResult.Create(db.Customers.Where(customers => customers.CustomerID == key));

This means that we can write /odata/CustomersEntity(‘ALFKI’) and we get only the corresponding record.

With OData are coming for free many interesting features regarding the querystring

For example we can write

That is we filter our data for Country = Mexico and we need only the company name and the fax; the result:

The condition could be complex, for example we can specify &filter=Country eq ‘Mexico’ and CustomerID eq ‘ANTON’

A reference of the OData query options at these addresses:

Categories: .NET, MVC, OData, Visual Studio 2013

Microsoft.SqlServer.Management.Sdk.Sfc not found

In theory within an updated, state of the art system it should be all ok, but it is not always so.

I’m using a brand new installed windows 8.1 , with Visual Studio 2013 and SQL Server 2014; all with the latest updates.

In a new Web application i was adding an ADO.NET Entity Data Model, operation that i done a lot in the past.

However, this time when creating the new connection to Northwind (my original intent is to create a web service for test) i got the error:

Searching on Internet i have seen that i’m not alone with this problem.

Could be the combination of Visual Studio 2013 with the very new SQL 2014? could be that until Visual Studio 2012 + SQL 2012 there was not this problem? i don’t have a pc with Visual studio 2012 and i don’t have the time to create an install an vm to verify these conditions.

On c:\windows\assembly in windows 8.1 i can see

Effectively no Microsoft.SqlServer.Management.Sdk.Sfc version=

Could be that this is a bug and it will be fixed, so i tried on a vm with Visual Studio 2010: here no problems for the creation of the model…

But in every case what does this part of the wizard? nothing more than add a connectionstring in the relative web.config section.

In the Visual Studio 2010 project i tried to connect the same Northwind on the same server which i tried to connect in the Visual Studio 2013 solution; in this case it was created this connectionstring:

<add name="NorthwindEntities" connectionString="metadata=res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model1.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=mysql2014svr;initial catalog=Northwind;persist security info=True;user id=sa;password=thepwd;multipleactiveresultsets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />

I pasted this connection string in the connectionstrings section of the Visual studio 2013 web.config, so the connection is already in place when adding the ADO.NET Data Model in the Visual Studio 2013 project:

Moreover, it can set my data model without problems:

Categories: .NET, Visual Studio 2013, WCF

Network path was not found error

I’ m working with networked computers from near 30 years, and with Microsoft networks from 20.

I still remember the old good times of Windows 3.11 (not For Workgroup) and the problems of a network between Win 3.11 and Windows 95 clients: there was no Internet, the network adapters were coming by floppy disks in the adapter box or by connecting to a remote BBS for the latest update.

It was the time of networking with Lantastic (i still remember the infamous “ding” sound when the network was clogged…) : so sometimes the best solution was a Novell Netware 286 dedicated server; but there was the problem in the client PCs , loading the Novell drivers chkdsk were erroneously reporting severe problems in the file system.

Now many problems are gone: i prepared a server with Windows 2012 Standard some months ago and i discovered that from the ASRock BIOS is possibile not only to download the requested drivers on a USB key (even if i found that if the USB key has no sufficient space the download apparently is anyway OK..) but if the server is connected to a working Internet connection is possible to require assistance to the producer, from the BIOS !

I was thinking to the same situation (network card unacknowledged) at the times when i was installing Windows NT 4.0 Workstation.

Now with the same server, reformatted and installed with Windows Server 2012 R2, no problem for the network card, no need for external download: Windows 2012 R2 has directly acknowledged the network card.

But there are still issues with Microsoft networking .. for example i installed an 2012 R2 as domain controller with address, the ADSL modem is and in practice is the DNS.

Then i installed another server dedicated to SharePoint 2013 (never install SharePoint on a domain controller) and the first thing is to join this server to the domain controller.

Tipically you go to Control Panel->System, change settings from workgroup to domain, write the domain name and click ok: after inserting when prompted the user “administrator” of the DC with the password .. a long wait … and then the error.

Ok, i’m primarily a developer so i don’t know very well some system arguments, but searching on Google i noticed that the error reported in the subject of this post is not so rare.

The solution is to set as DNS in the adapter property of the client not the ADSL modem address but the one of the DC : in my sample instead of

Done this, the domain is joined without a long wait and the internet connection is working.

There are other possible issues to verify: in the adapter property verify if is activated

“Client for Microsoft Networks”

and the services “Remote Registry” and “TCP/IP NetBIOS Helper” are running on DC and server that you would join to the DC.

Conclusion: a little hint from the OS when you get this error?

Categories: SharePoint, Uncategorized

Save the private

I was copying a vmware workstation virtual machine when death screen ! a problem with the USB drivers.

A .vmsn file (vmware snapshot) was ruined, vanished, i tried an undelete software but nothing to do.

The vmware vm was obviously unable to start, and there were 2 disks.

Ok, some work hours for the creation of a new vm, reinstalling all and rescuing the data from the old vm.

For the original vm second disk no problem, i opened the disk from the vmware workstation console, map the content to a drive :

and i was able to recover everything.

But with the main disk (the c: on vm) there is a problem : no way to access the Users folder , or the linked “Documents and settings” one.

I tried to change the perms , but without success: it seems that there are strange permissions linkings between the host and the virtual machine under Windows (if the host and the vm are both Windows based, in my case 2 Windows 7) and i’m not very expert in these issues.

But in the users folder there were some documents , especially on the Desktop folder, and i was needing those files.

How to do ? The solution is to add the vmware windows disk (.vmdk) ,our vm c:, to an Ubuntu virtual machine:

then the disk is immediately mapped and is possible to explore the user folders without permissions problems:

Then , via Samba or more simple with an external drive connected to the network, is possible to save the data.

Categories: VmWare

Get every new post delivered to your Inbox.