none
Web.Config file format RRS feed

  • Question

  • Hello everyone.

    Long time no post...

    This question sprouts from me having to create a mobile app using the devextreme framework. OK, I know this is the MSDN forums, and I know this is the .NET Framework section.

    My format of my web.config file is as follows :

    ?xml version="1.0" encoding="utf-8"?>

    <!--  For more information on how to configure your ASP.NET application, please visit  http://go.microsoft.com/fwlink/?LinkId=169433  -->

    <configuration> 

    <configSections>    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->   

    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> 

    </configSections> 

    <system.web>

        <compilation debug="true" targetFramework="4.5">

          <assemblies>

            <add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> 

         </assemblies>    </compilation>    <httpRuntime targetFramework="4.5" />

      </system.web>

      <system.serviceModel>

        <serviceHostingEnvironment aspNetCompatibilityEnabled="true" />

        <services> 

          <!--This section is optional with the default configuration-->

            <!--model introduced in .NET Framework 4-->

          <service name= 'Service.DataService'> 

            <!--This endpoint is exposed at the base address provided by host:   http://localhost/servicemodelsamples/service.svc-->

             <endpoint address="http://address.dyndns.org/Test_Service/TestService.svc"  binding="wsHttpBinding" 

                     contract='Service.IService1' />

         </service>

        </services>

          </system.serviceModel>

      <connectionStrings>   

    <add name="DataEntities" connectionString="metadata=res://*/DataModel.csdl|res://*/DataModel.ssdl|res://*/DataModel.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=htg\db;initial catalog=DBase;user id=hannes;password=123;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />

      </connectionStrings> 

    <entityFramework>   

    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />

      </entityFramework>

    </configuration>

    Now, I *think* my problem lies within this file. My problem is that when I browse to this service on the hosting server from the hosting server itself, I get an error saying that the web page cannot be found.

    I think the problem lies with my web.config file because all the pevious WCF services I made still runs perfectly.

    I am using Windows Server R2 Enterprise

    Any advice on how to format my web.config file correctly, or if there are any settings on IIS ( which I doubt ) that I should look into?

    Wednesday, July 22, 2015 12:25 PM

Answers

  • Hi HanneSThEGreaT,

    According to this case , If your service  hosted on IIS.So, I suggest you can modify your config file like below:

    <service name="WcfService3.Service1">
            <endpoint address=""  binding="wsHttpBinding"  contract="WcfService3.IService1"/>
             <endpoint address="mex"
                      binding="mexHttpBinding"
                      contract="IMetadataExchange" />
    </service>

    This node should be added as a child of the services  ( <services>).

    For more inforamtion , please refer to the following articles:

    1.How to: Host a WCF Service in IIS

    https://msdn.microsoft.com/en-us/library/ms733766(v=vs.110).aspx

    I hope that will be helpful to you.

    Best Regards,

    Tracy Dj


    Best Regards, Tracy Dj

    • Marked as answer by HanneSThEGreaT Wednesday, August 19, 2015 12:48 PM
    Thursday, July 23, 2015 9:08 AM
    Moderator
  • Hi HanneSThEGreaT,

    According to this issue ,I suggest you can modify your config file like below:

    <behaviors>
          <serviceBehaviors>
            <behavior name="DefaultBehavior">
              <serviceDebug includeExceptionDetailInFaults="true"/>
              <serviceMetadata httpGetEnabled="true"/>
            </behavior>
          </serviceBehaviors>
     </behaviors>

    This node should be added as a child of the system.serviceModel ( <system.serviceModel>).

    Now, you need to do is add behaviorConfiguration="DefaultBehavior" to the service element, so that line becomes:
    <service name="Daff.Lae.Service.TraceService" behaviorConfiguration="DefaultBehavior">

    I hope that will be helpful to you.

    Best Regards,

    Tracy Dj


    Best Regards, Tracy Dj

    Tuesday, July 28, 2015 6:10 AM
    Moderator

All replies

  • Any advice on this please? Should I provide more information?
    Thursday, July 23, 2015 8:56 AM
  • Hi HanneSThEGreaT,

    According to this case , If your service  hosted on IIS.So, I suggest you can modify your config file like below:

    <service name="WcfService3.Service1">
            <endpoint address=""  binding="wsHttpBinding"  contract="WcfService3.IService1"/>
             <endpoint address="mex"
                      binding="mexHttpBinding"
                      contract="IMetadataExchange" />
    </service>

    This node should be added as a child of the services  ( <services>).

    For more inforamtion , please refer to the following articles:

    1.How to: Host a WCF Service in IIS

    https://msdn.microsoft.com/en-us/library/ms733766(v=vs.110).aspx

    I hope that will be helpful to you.

    Best Regards,

    Tracy Dj


    Best Regards, Tracy Dj

    • Marked as answer by HanneSThEGreaT Wednesday, August 19, 2015 12:48 PM
    Thursday, July 23, 2015 9:08 AM
    Moderator
  • Hi Tracy.

    Thanks for looking into my problem.

    I have tried your suggestion; but now I get the following error:

    The contract name 'IMetadataExchange' could not be found in the list of contracts implemented by the service DataService.  Add a ServiceMetadataBehavior to the configuration file or to the ServiceHost directly to enable support for this contract.

    I do not know what to do further as I have just about tried every suggestion based on a google search about this

    Friday, July 24, 2015 10:43 AM
  • Hi HanneSThEGreaT,

    According to this issue ,I suggest you can modify your config file like below:

    <behaviors>
          <serviceBehaviors>
            <behavior name="DefaultBehavior">
              <serviceDebug includeExceptionDetailInFaults="true"/>
              <serviceMetadata httpGetEnabled="true"/>
            </behavior>
          </serviceBehaviors>
     </behaviors>

    This node should be added as a child of the system.serviceModel ( <system.serviceModel>).

    Now, you need to do is add behaviorConfiguration="DefaultBehavior" to the service element, so that line becomes:
    <service name="Daff.Lae.Service.TraceService" behaviorConfiguration="DefaultBehavior">

    I hope that will be helpful to you.

    Best Regards,

    Tracy Dj


    Best Regards, Tracy Dj

    Tuesday, July 28, 2015 6:10 AM
    Moderator