How to modify manually web application SharePoint web.config file when using asmx web service in an EventReceiver project?

111 Views Asked by At

First of all, I need to use an asmx web service in an EventReceiver project in Visual Studio. Then, as common, I add a web reference by right click on the project and then Add menu then Service Reference... menu and finally web service url something like enter image description here

and this my app.config project:

`
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <system.serviceModel>
        <bindings>
            <basicHttpBinding>
                <binding name="IntegrationService_UserSoap">
                    <security mode="Transport" />
                </binding>
                <binding name="IntegrationService_UserSoap1" />
            </basicHttpBinding>
        </bindings>
        <client>
            <endpoint address="https://???.???.??/services/???????/???.asmx"
                binding="basicHttpBinding" bindingConfiguration="IntegrationService_UserSoap"
                contract="ServiceReference1.IntegrationService_UserSoap" name="IntegrationService_UserSoap" />
        </client>
    </system.serviceModel>
</configuration>`

Then I'm going to modify web.config of the web application as I used to do like this:

<system.serviceModel>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
        <bindings>
            <basicHttpBinding>
                <binding name="IntegrationService_UserSoap">
                    <security mode="Transport" />
                </binding>
                <binding name="IntegrationService_UserSoap1" />
            </basicHttpBinding>
        </bindings>
        <client>
            <endpoint address="https://???.???.??/services/???????/???.asmx"
                binding="basicHttpBinding" bindingConfiguration="IntegrationService_UserSoap"
                contract="ServiceReference1.IntegrationService_UserSoap" name="IntegrationService_UserSoap" />
        </client>
  </system.serviceModel>

now, when I'm going to deploy the project by visual studio I've got this error: "Error occurred in deployment step 'Activate Features': Operation is not valid due to the current state of the object." What is wrong?

0

There are 0 best solutions below