VS2008 Crash while adding WCF service

I have a console application that has a WCF service:

Updated this code to run the app.config file instead of initializing it

Uri baseAddress = new Uri("http://localhost:8000/ChatServer/Service");
        ServiceHost myHost = new ServiceHost(typeof(ClientServerChat.ChatServer), baseAddress);

            myHost.AddServiceEndpoint(typeof(IChat), new WSHttpBinding(), "ChatService");
            ServiceMetadataBehavior mb = new ServiceMetadataBehavior();
            ServiceBehaviorAttribute attrib = (ServiceBehaviorAttribute)myHost.Description.Behaviors[0];
            attrib.IncludeExceptionDetailInFaults = true;
            mb.HttpGetEnabled = true;
            myHost.Description.Behaviors.Add(mb);

            myHost.Open();

      

The Console application compiles and runs. svcutil works great.

Svcutil works fine with new service code and generates client code and ouput file

I call svcutil through the Visual Studio command line like this: svcutil.exe http: // localhost: 8000 / ChatServer / Service

It generates this output.config file:

<?xml version="1.0" encoding="utf-8"?>
  <configuration>
   <system.serviceModel>
     <bindings>
       <wsHttpBinding>
         <binding name="WSHttpBinding_IChat" closeTimeout="00:01:00" openTimeout="00:01:00"
        receiveTimeout="00:10:00" sendTimeout="00:01:00" bypassProxyOnLocal="false"
        transactionFlow="false" hostNameComparisonMode="StrongWildcard"
        maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
        messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
        allowCookies="false">
           <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
          maxBytesPerRead="4096" maxNameTableCharCount="16384" />
           <reliableSession ordered="true" inactivityTimeout="00:10:00"
          enabled="false" />
           <security mode="Message">
             <transport clientCredentialType="Windows" proxyCredentialType="None"
            realm="" />
             <message clientCredentialType="Windows" negotiateServiceCredential="true"
            algorithmSuite="Default" establishSecurityContext="true" />
           </security>
         </binding>
       </wsHttpBinding>
     </bindings>
    <client>
       <endpoint address="http://localhost:8000/ChatServer/Service/ChatService"
      binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IChat"
      contract="IChat" name="WSHttpBinding_IChat">
         <identity>
           <userPrincipalName value="Bedroom-PC\Roberto" />
         </identity>
      </endpoint>
     </client>
   </system.serviceModel>
 </configuration>

      

Along with the bundle of client code (which is in the same directory as the output file, I have to add), I should be able to call the service with this:

ChatClient client = new ChatClient();

      

New svcutil output (both code and config) still throws this exception.

But it throws an exception:

"Could not find a default endpoint element that references an IChat contract in the client configuration section of the ServiceModel. This may be because the configuration file was not found for your application, or because the client did not find an endpoint element matching this contract is an element ".

Interestingly, Visual Studio 2008 will crash when you add the same service reference to the client project.

VS2008 is still crashing with updated code.

He will find the service, get all the transactions, and what not. When I click the Add button, it resets.

Someone has a clue what's going on?

Thank you in advance

Roberto

0


source to share


3 answers


I fixed it.

I copied and pasted the system.serviceModel section from output.config to app.config after the userSettings section and commented out the entire output.config file.



I also specified the endpoint name when initializing the ChatClient ("name").

It seems to work.

0


source


Have you tried using a config file setting rather than doing it programmatically? Then at least you will know if this is a general settings problem or something to do with your code. Then you can expand the code bits one by one; mex, then the endpoint and see who kills her.



0


source


Does VS2008 just die without feedback? If so, check the Windows event log (application log) for error messages.

One plausible reason: VS2008 + System.Core.dll 3.5 + bad NGen images can crash when VS2008 tries to load either System.Core or anything that references / depends on it.

You can also attach one VS instance to another (like a debugger) to see more details about crashes. But first I have to investigate the System.Core / NGen track.

https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=341658 https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=337149 https://connect.microsoft. com / VisualStudio / feedback / ViewFeedback.aspx? FeedbackID = 330302 https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=330903

0


source







All Articles