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

  • Question

  • User-1651183775 posted

    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 12:12 PM

Answers

  • User1168443798 posted

    Hi kodnil,

    How did you create WCF Data Service? Could you share us a simple demo which could reproduce your issue?

    For your code, it is WCF Data Service, for web.config, it seems to be WCF Rest Service. Did you combine Data Service and Rest Service in the same project?

    For a general WCF Rest Service, you could specify “*” on Method, but you could not set it as “*” while you add “<enableWebScript />”. If you need “*”, you need to remove “<enableWebScript />”. If you need “<enableWebScript />”, you need to replace “*” with “POST”.

    Best Regards,

    Edward

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, October 12, 2017 6:49 AM

All replies

  • User1168443798 posted

    Hi kodnil,

    How did you create WCF Data Service? Could you share us a simple demo which could reproduce your issue?

    For your code, it is WCF Data Service, for web.config, it seems to be WCF Rest Service. Did you combine Data Service and Rest Service in the same project?

    For a general WCF Rest Service, you could specify “*” on Method, but you could not set it as “*” while you add “<enableWebScript />”. If you need “*”, you need to remove “<enableWebScript />”. If you need “<enableWebScript />”, you need to replace “*” with “POST”.

    Best Regards,

    Edward

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, October 12, 2017 6:49 AM
  • User-1651183775 posted

    Hi Edward,

    I used "WCF Service(Ajax Enabled)" in VS 2017 to create WCF Data Service as i did not find specific template for the same. When i removed <enableWebScript />, my this particular error has gone and getting new error about SQL connection which i think will require different troubleshooting. My question to you : Is it ok if i Remove <enableWebScript /> and use it as WCF data service OR i have to make additional changes to make it work?

    Thursday, October 12, 2017 8:42 AM
  • User1168443798 posted

    Hi kodnil,

    >>Is it ok if i Remove <enableWebScript /> and use it as WCF data service OR i have to make additional changes to make it work?

    It seems you want to develop WCF Data Service, there is no template for WCF Data Service, you could create a web application, and then add WCF Data Service by adding New Item.

    You could follow below link for how to create WCF Data Service.

    # Creating the Data Service

    https://docs.microsoft.com/en-us/dotnet/framework/data/wcf/creating-the-data-service

    Best Regards,

    Edward

    Friday, October 13, 2017 5:20 AM
  • User-1651183775 posted

    Hello Ed,

    I tried the steps as per the article. still no luck. I dont see WCF Data Service Template

    Friday, October 13, 2017 12:14 PM
  • User1168443798 posted

    Hi kodnil,

    Do you make a test with VS 2015 or VS 2017? It does not exist under VS 2017.

    Best Regards,

    Edward

    Monday, October 16, 2017 3:20 AM