Failed to add a service. Service metadata may not be accessible. Make sure your service is running and exposing metadata.`

后端 未结 16 2150
清歌不尽
清歌不尽 2020-12-04 15:42

EDIT:

After I modified the web.config and I don\'t get error that\'s good.... then I add a new page (html) and write this small code to consume the serv

16条回答
  •  遥遥无期
    2020-12-04 16:21

    In my case, the Webservice was generating the assembly with a different name than the project/service name. It was set like that by my predecessor developer working on the solution and I didn't know.

    It was set to -

      
        
          
         
     
    

    So, the fix was the put the right assembly name in serviceAuthorizationManagerType. The assembly name can be obtained from following path of the service project: Right click on the WCF svc project--> Select "Properties" --> From the list of tabs select "Application". Check the value against "Assembly name:" field in the list. This is the assemblyName to use for serviceAuthorizationManagerType which may not be the servicename necessarily.

      
        
          
         
     
    

    remember to follow the instruction for serviceAuthorizationManagerType as mentioned on https://docs.microsoft.com/en-us/dotnet/framework/wcf/extending/how-to-create-a-custom-authorization-manager-for-a-service

    It says -

    Warning

    Note that when you specify the serviceAuthorizationManagerType, the string must contain the fully qualified type name. a comma, and the name of the assembly in which the type is defined. If you leave out the assembly name, WCF will attempt to load the type from System.ServiceModel.dll.

提交回复
热议问题