How to add WCF Web API with ASP.NET MVC 3 to existing VB.NET solution?

Im trying to implement this code: http://wcf.codeplex.com/wikipage?title=Getting%20started:%20Building%20a%20simple%20web%20api and want to add it to my existing VB.NET solution.

But when I look at the source code I see a code behind file for global.asax (Global.asax.cs) file with a namespace defined in it?!?

Now in my existing VB.NET solution I DONT have a code behind file. Here's what my global.asax looks like:

<%@ Import Namespace="System.Web" %>
<%@ Import Namespace="System.Web.HttpCookie" %>
<%@ Import Namespace="System.Web.SessionState" %>
<%@ Import Namespace="System.Security.Principal" %>
<%@ Import Namespace="System.Web.Security.FormsIdentity" %>
<%@ Import Namespace="System.Threading" %>
<%@ Import Namespace="System.Resources" %>
<%@ Import Namespace="System.Globalization" %>
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="System.Reflection" %>
<%@ Import Namespace="System" %>
<%@ Import Namespace="System.Collections.Generic" %>
<%@ Import Namespace="System.Linq" %>
<%@ Import Namespace="System.Web" %>
<%@ Import Namespace="Microsoft.ApplicationServer.Http.Activation" %>
<%@ Import Namespace="System.ServiceModel.Activation" %>
<%@ Import Namespace="Microsoft.ApplicationServer.Http" %>
<%@ Import Namespace="ContactManager.APIs" %>

<script language="VB" runat="server">

Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
    Application("RM") = New ResourceManager("strings", Assembly.Load("strings"))        
End Sub
</script>

When I add the namespace code as in the sample code I get: 'Namespace' statements can occur only at file or namespace level.

How can I implement the sample code correctly in my current solution?

Answers


You don't need to specify the namespace.


Need Your Help

Getting list of contacts with Gnome-Shell JS interface

javascript gobject gnome-shell gnome-shell-extensions gjs

I've just started fiddling with writing gnome-shell extensions, and would like to know how to get a list of contacts a user has.

Nginx: How to forward requests to a port using proxy_pass

nginx virtualhost server proxypass

I'm just getting started with Nginx and am trying to set up a server block to forward all requests on the subdomain api.mydomain.com to port 8080.