# Where to implement startup code in VB.Net project?

**URL:** https://discuss.hangfire.io/t/where-to-implement-startup-code-in-vb-net-project/4772
**Category:** question
**Created:** [June 11, 2018, 7:41pm UTC](https://discuss.hangfire.io/t/where-to-implement-startup-code-in-vb-net-project/4772 "2018-06-11T19:41:46Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![CoastalData](https://dub1.discourse-cdn.com/flex017/user_avatar/discuss.hangfire.io/coastaldata/32/1338_2.png) [@CoastalData](https://discuss.hangfire.io/u/CoastalData)
#### Post date: [June 11, 2018, 7:41pm UTC](https://discuss.hangfire.io/t/where-to-implement-startup-code-in-vb-net-project/4772/1 "2018-06-11T19:41:46Z")

</div>

Hello,

I’ve just started to integrate Hangfire into an existing [ASP.Net](http://ASP.Net) VB project. I’ve got most of the code converted from c# and usable, but I’m not sure where to put the code that would normally go into startup.cs.

Also, my project uses ASP forms authentication, so I’m not sure how to configure the OWIN portions of the dashboard.

Currently, my project is showing this error:

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.  
To disable OWIN startup discovery, add the appSetting owin:AutomaticAppStartup with a value of “false” in your web.config.  
To specify the OWIN startup Assembly, Class, or Method, add the appSetting owin:AppStartup with the fully qualified startup class or configuration method name in your web.config.

Thanks in advance for your help!

–Jon

---

<div class="post-metadata">

### Author: ![CoastalData](https://dub1.discourse-cdn.com/flex017/user_avatar/discuss.hangfire.io/coastaldata/32/1338_2.png) [@CoastalData](https://discuss.hangfire.io/u/CoastalData)
#### Post date: [June 11, 2018, 8:08pm UTC](https://discuss.hangfire.io/t/where-to-implement-startup-code-in-vb-net-project/4772/2 "2018-06-11T20:08:15Z")

</div>

Oh! I think I’ve got it figured out… I just created a new class file in App\_Code called Startup.vb, and then I used the code from this post, with one fix: [Using hangfire in Vb.net](http://hangfire.discourse.group/t/using-hangfire-in-vb-net/4493)

The fixed code is posted below:

```
Public Sub Configuration(app As IAppBuilder)
    
GlobalConfiguration.Configuration.UseSqlServerStorage("conString")
    Dim options = New DashboardOptions With {.AppPath = VirtualPathUtility.ToAbsolute("~")}
    app.UseHangfireDashboard("/hangfire", options)
    app.UseHangfireServer()
End Sub

```

Hope somebody finds this useful!

---

<div class="post-metadata">

### Author: ![Anthony](https://dub1.discourse-cdn.com/flex017/user_avatar/discuss.hangfire.io/anthony/32/1806_2.png) [@Anthony](https://discuss.hangfire.io/u/Anthony)
#### Post date: [October 23, 2019, 8:23am UTC](https://discuss.hangfire.io/t/where-to-implement-startup-code-in-vb-net-project/4772/3 "2019-10-23T08:23:33Z")

</div>

Thanks. That actually worked. What I cannot seem to do is keep it alive. Even with the AppPool “alwaysrunning” it dies and won’t run overnight. Have you managed to get this to function in production?

---

<div class="post-metadata">

### Author: ![CoastalData](https://dub1.discourse-cdn.com/flex017/user_avatar/discuss.hangfire.io/coastaldata/32/1338_2.png) [@CoastalData](https://discuss.hangfire.io/u/CoastalData)
#### Post date: [January 10, 2021, 4:39pm UTC](https://discuss.hangfire.io/t/where-to-implement-startup-code-in-vb-net-project/4772/4 "2021-01-10T16:39:26Z")

</div>

No, how about you? I could really use it right about now.
