Struggling to compile example

Oct 29, 2013 at 3:04 PM
Hi Serena

I have downloaded your sample aspnet wcf ef app, I followed your instructions creating the workflow database and sample leave database etc.

However when I run the application I get one browser showing


HTTP Error 403.14 - Forbidden

The Web server is configured to not list the contents of this directory.



Most likely causes:
•A default document is not configured for the requested URL, and directory browsing is not enabled on the server.



Things you can try:
•If you do not want to enable directory browsing, ensure that a default document is configured and that the file exists.
• Enable directory browsing. 1.Go to the IIS Express install directory.
2.Run appcmd set config /section:system.webServer/directoryBrowse /enabled:true to enable directory browsing at the server level.
3.Run appcmd set config ["SITE_NAME"] /section:system.webServer/directoryBrowse /enabled:true to enable directory browsing at the site level.

•Verify that the configuration/system.webServer/directoryBrowse@enabled attribute is set to true in the site or application configuration file.



Detailed Error Information:



Module
DirectoryListingModule

Notification
ExecuteRequestHandler

Handler
StaticFile

Error Code
0x00000000



Requested URL
http://localhost:13619/ Physical Path C:\Users\AMcInnes\Downloads\LeaveSample-ASPNET-WCF-EF-130620\ASPNET-WCF-EF\Hosts\LeaveSample.Hosts.Web

Logon Method
Anonymous

Logon User
Anonymous

Request Tracing Directory
C:\Users\AMcInnes\Documents\IISExpress\TraceLogFiles\LEAVESAMPLE.HOSTS.WEB




More Information:
This error occurs when a document is not specified in the URL, no default document is specified for the Web site or application, and directory listing is not enabled for the Web site or application. This setting may be disabled on purpose to secure the contents of the server.
View more information »


And the code errors at:

query = query.Where(l => l.Employee == employee);

From:

private static IQueryable<Leave> AppendFilters(IQueryable<Leave> query,
        string employee, LeaveCategories? category, LeaveStatuses? status)
    {
        // Filter employee.
        if (!string.IsNullOrWhiteSpace(employee))
            query = query.Where(l => l.Employee == employee);

        // Filter category.
        if (category != null)
            query = query.Where(l => l.Category == category);

        // Filter status.
        if (status != null)
            query = query.Where(l => l.Status == status);
        return query;
    }
With error:

The entity type Leave is not part of the model for the current context.

And stack:

at System.Data.Entity.Internal.InternalContext.UpdateEntitySetMappingsForType(Type entityType)
at System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType)
at System.Data.Entity.Internal.Linq.InternalSet1.Initialize()
at System.Data.Entity.Internal.Linq.InternalSet
1.get_InternalContext()
at System.Data.Entity.Infrastructure.DbQuery1.System.Linq.IQueryable.get_Provider()
at System.Linq.Queryable.Where[TSource](IQueryable
1 source, Expression1 predicate)
at LeaveSample.Data.LeaveDAC.AppendFilters(IQueryable
1 query, String employee, Nullable1 category, Nullable1 status) in c:\Users\AMcInnes\Downloads\LeaveSample-ASPNET-WCF-EF-130620\ASPNET-WCF-EF\Data\LeaveSample.Data\LeaveDAC.cs:line 147
at LeaveSample.Data.LeaveDAC.Select(Int32 maximumRows, Int32 startRowIndex, String sortExpression, String employee, Nullable1 category, Nullable1 status) in c:\Users\AMcInnes\Downloads\LeaveSample-ASPNET-WCF-EF-130620\ASPNET-WCF-EF\Data\LeaveSample.Data\LeaveDAC.cs:line 100
at LeaveSample.Business.LeaveComponent.ListLeavesByEmployee(Int32 maximumRows, Int32 startRowIndex, String sortExpression, String employee, Nullable1 category, Nullable1 status, Int32& totalRowCount) in c:\Users\AMcInnes\Downloads\LeaveSample-ASPNET-WCF-EF-130620\ASPNET-WCF-EF\Business\LeaveSample.Business\LeaveComponent.cs:line 173
at LeaveSample.Services.LeaveService.ListLeavesByEmployee(Int32 maximumRows, Int32 startRowIndex, String sortExpression, String employee, Nullable1 category, Nullable1 status, Int32& totalRowCount) in c:\Users\AMcInnes\Downloads\LeaveSample-ASPNET-WCF-EF-130620\ASPNET-WCF-EF\Services\LeaveSample.Services\LeaveService.cs:line 69
at SyncInvokeListLeavesByEmployee(Object , Object[] , Object[] )
at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs)
at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc)

Any ideas what I am doing wrong?

Many thanks,

Andy
Coordinator
Nov 11, 2013 at 11:24 PM
Hi Andy,

The LeaveSample.Hosts.Web is your service layer boundary and will always show HTTP Error 403.14 Forbidden because it does not have anything 'to show' by default. If you would like to check whether your services endpoint are up, you may proceed to type out the full URL i.e. http://localhost:13619/LeaveService.svc or http://localhost:13619/LeaveWorkflowService.svc.

After creating the database, please make sure you change the connection strings in the web.config file of the LeaveSample.Hosts.Web project. There are 2 of them, 1 for the Workflow Instance Store, the other is for the Entity Framework connection.

Hugs,
Serena