Why does my Nancy module generate an "Unable to resolve type" error at startup?

时间:2016-04-25 09:00:09

标签: nancy

I added this nancy module to my previously working nancy application. It compiles, but at application startup I get an error : "Unable to resolve type: HubJH.Web.SignAndStore.SignAndStoreModule"

public class SignAndStoreModule : NancyModule
{
    private IConnectionFactory connFac;
    SignAndStoreModule(IConnectionFactory connFac)
    {
        this.connFac = connFac;
        Post["/"] = p =>
        {
            return 200;
        };
    }
}

What am I doing wrong?

1 个答案:

答案 0 :(得分:1)

Ok silly me. The constructor needs to be public. So this works...

public class SignAndStoreModule : NancyModule
{
    private IConnectionFactory connFac;
    public SignAndStoreModule(IConnectionFactory connFac)
    {
        this.connFac = connFac;
        Post["/"] = p =>
        {

            return 200;
        };
    }
}