locked
Operation 'ProcessRequestForMessage' in contract 'IRequestHandler' specifies Method '*' on the WebGetAttribute/WebInvokeAttribute. RRS feed

  • Question

  • Hello,

    I have created WCF data service Framework 4.6.1 and EF6. I am getting below error when i try to publish the service. Appreciate your inputs as i am new to this:

    Operation 'ProcessRequestForMessage' in contract 'IRequestHandler' specifies Method '*' on the WebGetAttribute/WebInvokeAttribute, but the only allowed values for Method are GET or POST. Other values are not supported by 'System.ServiceModel.Description.WebScriptEnablingBehavior'. 

    My code looks like:

    [ServiceBehavior(IncludeExceptionDetailInFaults = true)]
        [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
        public class MyService : DataService<ObjectContext>
        {
           
            public static void InitializeService(IDataServiceConfiguration config)
            {
                config.SetEntitySetAccessRule("*", EntitySetRights.All);
                config.UseVerboseErrors = true;
            }
    
            protected override ObjectContext CreateDataSource()
            {
                var context = new RegistryContext();
                var objectContext = ((IObjectContextAdapter)context).ObjectContext;
                objectContext.ContextOptions.ProxyCreationEnabled = false;
    
                return objectContext;
            }
        }

    Config file looks like:

    <system.serviceModel>
        <services>
          <service name="Services.MyService">
            <endpoint address="" behaviorConfiguration="Services.MyServiceAspNetAjaxBehavior"
              binding="webHttpBinding" contract="System.Data.Services.IRequestHandler" />
          </service>
        </services>
        <behaviors>
          <endpointBehaviors>
            <behavior name="Service.MyServiceAspNetAjaxBehavior">
              <enableWebScript />
            </behavior>
          </endpointBehaviors>
          <serviceBehaviors>
            <behavior name="">
              <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
              <serviceDebug includeExceptionDetailInFaults="false" />
            </behavior>
          </serviceBehaviors>
        </behaviors>
        <protocolMapping>
          <add binding="basicHttpsBinding" scheme="https" />
        </protocolMapping>
        <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
      </system.serviceModel>

    Wednesday, October 11, 2017 1:27 PM

All replies

  • Hi Kodnil,

    It looks like you are mixing SOAP with data service,  since data service is actually a REST service,  it cannot be mixed with SOAP.

    To define a service operation, apply the [WebGet] or [WebInvoke] attribute to the method. To support query operators, the service operation must return an IQueryable<T> instance.

    Check this article: https://docs.microsoft.com/en-us/dotnet/framework/data/wcf/how-to-define-a-service-operation-wcf-data-services

    Best Regards,

    Bob


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Saturday, October 14, 2017 8:37 AM