1
votes

I followed this tutorial on creating a SignalR app that doesnt need IIS...

http://www.asp.net/signalr/overview/signalr-20/getting-started-with-signalr-20/tutorial-signalr-20-self-host

However when I run it, the browser launches with this url in a tab...

`http://localhost:57719/Default.html`

and I can see in the taskbar that IIS Express has launched.

Can someone confirm that IIS should not launch (I assumed that I was creating a self contained app that didnt need IIS)?

Any ideas what I might have done wrong? (Please let me know what bits of code etc you need posted to help me figure this out.)

2
Are you using a web project or a console application....? - davidfowl
@dfowler, he SignalRSelfHost project is a consoleApp and the JavascriptClient is an empty ASP.NET web project with signalR installed and with a single HTML page - spiderplant0
Then I have no idea what you're asking. You want to know how to server tatic files from the self host? - davidfowl
Yes, I want to serve up the initial page that contains the SignalR javascript, chat javascript etc, (once this page loads, the page's signalR will continue to communicate with the self hosted server). The tutorial that I followed causes IIS to launch - but surely the whole point of self-hosting is to host without needing IIS? - spiderplant0

2 Answers

1
votes

I've created project, added packages, copied code

I replaced this

   WebApp.Start(url)

with

WebApp.Start<Startup>(url)

It works fine without IIS.

I got exception with message

The following errors occurred while attempting to load the app. - No assembly found containing an OwinStartupAttribute. - No assembly found containing a Startup or [AssemblyName].Startup class.

When I start it with WebApp.Start(url)

I used .NET 4.5 project Here are references after installing packages

    <Reference Include="Microsoft.AspNet.SignalR.Core">
      <HintPath>..\packages\Microsoft.AspNet.SignalR.Core.2.0.1\lib\net45\Microsoft.AspNet.SignalR.Core.dll</HintPath>
    </Reference>
    <Reference Include="Microsoft.Owin">
      <HintPath>..\packages\Microsoft.Owin.2.1.0\lib\net45\Microsoft.Owin.dll</HintPath>
    </Reference>
    <Reference Include="Microsoft.Owin.Cors">
      <HintPath>..\packages\Microsoft.Owin.Cors.2.1.0\lib\net45\Microsoft.Owin.Cors.dll</HintPath>
    </Reference>
    <Reference Include="Microsoft.Owin.Diagnostics">
      <HintPath>..\packages\Microsoft.Owin.Diagnostics.2.0.2\lib\net40\Microsoft.Owin.Diagnostics.dll</HintPath>
    </Reference>
    <Reference Include="Microsoft.Owin.Host.HttpListener">
      <HintPath>..\packages\Microsoft.Owin.Host.HttpListener.2.0.2\lib\net45\Microsoft.Owin.Host.HttpListener.dll</HintPath>
    </Reference>
    <Reference Include="Microsoft.Owin.Hosting">
      <HintPath>..\packages\Microsoft.Owin.Hosting.2.0.2\lib\net45\Microsoft.Owin.Hosting.dll</HintPath>
    </Reference>
    <Reference Include="Microsoft.Owin.Security">
      <HintPath>..\packages\Microsoft.Owin.Security.2.0.2\lib\net45\Microsoft.Owin.Security.dll</HintPath>
    </Reference>

Check versions maybe there are issues with previous. Because with this libs code throw Exception, I described above.

0
votes

Finally figured it out...

Delete JavescriptClient (the asp.net web project) from the solution as it is not needed if you just want to access the server from a web browser.

Follow the instructions in paragraph "Setting up Static Hosting and a JavaScript SignalR client" here ...

http://www.dotnetcurry.com/showarticle.aspx?ID=918

(Basically you need to install another package to allow the self hosted signalR server to server up pages).