Relationship between SVC files and WCF projects?

后端 未结 3 1379
梦毁少年i
梦毁少年i 2021-02-01 15:47

When creating a WCF project, the default member files are just ordinary csharp class files, rather than svc files. Are svc files required with a WCF project? When should they be

3条回答
  •  一个人的身影
    2021-02-01 16:37

    .svc files are used when you host your WCF service in IIS.

    See Microsoft's doc here and here.

    There's a module within IIS that handles the .svc file. Actually, it is the ASPNET ISAPI Module, which hands off the request for the .svc file to one of the handler factory types that has been configured for ASPNET, in this case

    System.ServiceModel.Activation.HttpHandler, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089


    If you are hosting your WCF service in something other than IIS, then you don't need the .svc file.

提交回复
热议问题