C# 连接到GP Web服务引发异常
我正在尝试连接到GP webservice以从C#应用程序创建销售订单。但当我尝试连接时,它抛出异常,如下所示C# 连接到GP Web服务引发异常,c#,web-services,dynamic,gp,C#,Web Services,Dynamic,Gp,我正在尝试连接到GP webservice以从C#应用程序创建销售订单。但当我尝试连接时,它抛出异常,如下所示 The application encountered an unhandled system exception. Contact your system administrator for details. 下面是我的app.config文件 <?xml version="1.0" encoding="utf-8" ?> <configuration>
The application encountered an unhandled system exception. Contact your system administrator for details.
下面是我的app.config文件
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<bindings>
<wsHttpBinding>
<binding name="GPWebService" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00"
sendTimeout="00:01:00" bypassProxyOnLocal="false"
transactionFlow="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"
messageEncoding="Text" textEncoding="utf-8"
useDefaultWebProxy="true" allowCookies="false">
<readerQuotas maxDepth="32" maxStringContentLength="8192"
maxArrayLength="16384" maxBytesPerRead="4096"
maxNameTableCharCount="2147483647" />
<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://WSGP:48620/Dynamics/GPService/GPService"
binding="wsHttpBinding" bindingConfiguration="GPWebService"
contract="GPWebService.DynamicsGP" name="GPWebService">
<identity>
<userPrincipalName value="WSGP\Administrator" />
</identity>
</endpoint>
</client>
</system.serviceModel>
</configuration>
GP配置文件在下面
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="cachingConfiguration" type="Microsoft.Dynamics.EnterpriseLibrary.Caching.Configuration.CacheManagerSettings, Microsoft.Dynamics.EnterpriseLibrary.Caching, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</configSections>
<cachingConfiguration configSource="WSCachingConfiguration.config"/>
<appSettings file="WSServiceAppSettings.config">
<add key="SecurityRuntimeAuditQueuing" value="0"/>
<add key="SecurityRuntimeAuditingIsActive" value="false"/>
</appSettings>
<system.serviceModel>
<bindings configSource="WSBindings.config"/>
<services>
<service name="Microsoft.Dynamics.GP.WebServices.Contract.DynamicsGP" behaviorConfiguration="GPWCFStaticMetadataBehavior">
<endpoint address="Mex" name="http" binding="customBinding" bindingConfiguration="CustomBinding" contract="IMetadataExchange"/>
<endpoint address="GPService" name="GPWebService" binding="wsHttpBinding" bindingConfiguration="WSHttpBindingTarget" contract="Microsoft.Dynamics.GP.WebServices.Contract.IGPServices"/>
<host>
<baseAddresses>
<add baseAddress="http://WSGP:48620/Dynamics/GPService"/>
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="GPWCFStaticMetadataBehavior">
<serviceThrottling maxConcurrentSessions="1024"/>
<serviceMetadata httpGetEnabled="true" externalMetadataLocation="http://WSGP:48620/Metadata/WCF/Full/schemas.microsoft.com.dynamics.gp.2010.01.wsdl"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
<dataContractSerializer maxItemsInObjectGraph="2147483647"/>
<serviceCredentials>
<userNameAuthentication cacheLogonTokens="true"/>
</serviceCredentials>
</behavior>
<behavior name="GPDynamicMetadataBehavior">
<serviceThrottling maxConcurrentSessions="1024"/>
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
<dataContractSerializer maxItemsInObjectGraph="2147483647"/>
<serviceCredentials>
<userNameAuthentication cacheLogonTokens="true"/>
</serviceCredentials>
</behavior>
</serviceBehaviors>
</behaviors>
<client/>
</system.serviceModel>
<system.diagnostics>
<switches>
<add name="ApplicationTraceSwitch" value="0"/>
</switches>
<trace autoflush="true" indentsize="4">
<listeners>
<add name="dynamicsListener"/>
</listeners>
</trace>
<sources>
<source name="System.ServiceModel" switchValue="" propagateActivity="true">
<!--Values can be:http://msdn.microsoft.com/en-us/library/ms733025.aspx -->
<listeners>
<add name="wcfListener"/>
</listeners>
</source>
<source name="System.IO.Log">
<listeners>
<add name="wcfListener"/>
</listeners>
</source>
<source name="System.Runtime.Serialization">
<listeners>
<add name="wcfListener"/>
</listeners>
</source>
<source name="System.IdentityModel">
<listeners>
<add name="wcfListener"/>
</listeners>
</source>
</sources>
<sharedListeners>
<add name="wcfListener" type="System.Diagnostics.XmlWriterTraceListener" initializeData="C:\Program Files\Microsoft Dynamics\GPWebServices\Logs\Tracing\GPWebServices.svclog"/>
<add name="dynamicsListener" type="System.Diagnostics.TextWriterTraceListener" initializeData="C:\Program Files\Microsoft Dynamics\GPWebServices\Logs\Tracing\GPWebServices.log"/>
</sharedListeners>
</system.diagnostics>
</configuration>
我做错了什么?配置文件中是否缺少某些内容
我应该说,我是Web服务开发的新手。这是一个问题,因为我传递了错误的公司ID,我从DynamicWebserviceExceptionConsole获得了异常详细信息。当我试图传递一个正确的公司ID时,这是有效的。对于此类错误,您需要转到Dynamics“Web服务异常”控制台。在那里,您将能够看到该错误的详细信息。 要打开它,请在此处找到它: C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Administrative Tools\Dynamics GP Web服务异常管理控制台 或 “C:\Program Files\Common Files\microsoft shared\microsoft Dynamics\ManagementConsole\DynamicsWebServicesExceptionsConsole.msc“
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="cachingConfiguration" type="Microsoft.Dynamics.EnterpriseLibrary.Caching.Configuration.CacheManagerSettings, Microsoft.Dynamics.EnterpriseLibrary.Caching, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</configSections>
<cachingConfiguration configSource="WSCachingConfiguration.config"/>
<appSettings file="WSServiceAppSettings.config">
<add key="SecurityRuntimeAuditQueuing" value="0"/>
<add key="SecurityRuntimeAuditingIsActive" value="false"/>
</appSettings>
<system.serviceModel>
<bindings configSource="WSBindings.config"/>
<services>
<service name="Microsoft.Dynamics.GP.WebServices.Contract.DynamicsGP" behaviorConfiguration="GPWCFStaticMetadataBehavior">
<endpoint address="Mex" name="http" binding="customBinding" bindingConfiguration="CustomBinding" contract="IMetadataExchange"/>
<endpoint address="GPService" name="GPWebService" binding="wsHttpBinding" bindingConfiguration="WSHttpBindingTarget" contract="Microsoft.Dynamics.GP.WebServices.Contract.IGPServices"/>
<host>
<baseAddresses>
<add baseAddress="http://WSGP:48620/Dynamics/GPService"/>
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="GPWCFStaticMetadataBehavior">
<serviceThrottling maxConcurrentSessions="1024"/>
<serviceMetadata httpGetEnabled="true" externalMetadataLocation="http://WSGP:48620/Metadata/WCF/Full/schemas.microsoft.com.dynamics.gp.2010.01.wsdl"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
<dataContractSerializer maxItemsInObjectGraph="2147483647"/>
<serviceCredentials>
<userNameAuthentication cacheLogonTokens="true"/>
</serviceCredentials>
</behavior>
<behavior name="GPDynamicMetadataBehavior">
<serviceThrottling maxConcurrentSessions="1024"/>
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
<dataContractSerializer maxItemsInObjectGraph="2147483647"/>
<serviceCredentials>
<userNameAuthentication cacheLogonTokens="true"/>
</serviceCredentials>
</behavior>
</serviceBehaviors>
</behaviors>
<client/>
</system.serviceModel>
<system.diagnostics>
<switches>
<add name="ApplicationTraceSwitch" value="0"/>
</switches>
<trace autoflush="true" indentsize="4">
<listeners>
<add name="dynamicsListener"/>
</listeners>
</trace>
<sources>
<source name="System.ServiceModel" switchValue="" propagateActivity="true">
<!--Values can be:http://msdn.microsoft.com/en-us/library/ms733025.aspx -->
<listeners>
<add name="wcfListener"/>
</listeners>
</source>
<source name="System.IO.Log">
<listeners>
<add name="wcfListener"/>
</listeners>
</source>
<source name="System.Runtime.Serialization">
<listeners>
<add name="wcfListener"/>
</listeners>
</source>
<source name="System.IdentityModel">
<listeners>
<add name="wcfListener"/>
</listeners>
</source>
</sources>
<sharedListeners>
<add name="wcfListener" type="System.Diagnostics.XmlWriterTraceListener" initializeData="C:\Program Files\Microsoft Dynamics\GPWebServices\Logs\Tracing\GPWebServices.svclog"/>
<add name="dynamicsListener" type="System.Diagnostics.TextWriterTraceListener" initializeData="C:\Program Files\Microsoft Dynamics\GPWebServices\Logs\Tracing\GPWebServices.log"/>
</sharedListeners>
</system.diagnostics>
</configuration>