I'm rather new to WCF so I'm struggling with the web.config.
I created a WCF service on IIS10. Here is my web.config:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
</configSections>
<system.web>
<customErrors mode="Off" />
<compilation targetFramework="4.0" debug="true">
<assemblies>
<add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</assemblies>
</compilation>
<caching>
<outputCacheSettings>
<outputCacheProfiles>
<add name="DefaultCache" duration="60" varyByParam="none" />
</outputCacheProfiles>
</outputCacheSettings>
</caching>
<authentication mode="Windows" />
</system.web>
<system.serviceModel>
<services>
<service name="FileStorageService.FileService">
<endpoint address="" binding="basicHttpBinding" bindingConfiguration="basicHttpBindingConfiguration" contract="FileStorageService.IFileService" />
<!--<endpoint address="mex"
binding="mexHttpsBinding"
contract="IMetadataExchange" />-->
</service>
</services>
<bindings>
<basicHttpBinding>
<binding name="basicHttpBindingConfiguration">
<security mode="Transport">
<transport clientCredentialType="Basic" proxyCredentialType="None" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior>
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpsGetEnabled="true" httpGetEnabled="false" />
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<httpErrors errorMode="Detailed" />
<modules runAllManagedModulesForAllRequests="true" />
</system.webServer>
<connectionStrings>
</connectionStrings>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
<parameters>
<parameter value="v11.0" />
</parameters>
</defaultConnectionFactory>
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
</entityFramework>
</configuration>
I can reference the api but I'm getting this message when I attempt to use it:
Server stack trace: at System.ServiceModel.Channels.ServiceChannel.ThrowIfFaultUnderstood(Message reply, MessageFault fault, String action, MessageVersion version, FaultConverter faultConverter) at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc) at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout) at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation) at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
Exception rethrown at [0]: at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) at PpsTransactionFile.MyFileServiceReference.IFileService.DownloadPpsZipFile(DownloadFileRequest downloadFileRequest) at PpsTransactionFile.MyFileServiceReference.FileServiceClient.DownloadPpsZipFile(DownloadFileRequest downloadFileRequest) in D:\Source\Sub\Web Projects\WebStorageApps\PpsTransactionFile\Service References\MyFileServiceReference\Reference.cs:line 493 at PpsTransactionFile.download.DownloadFile.DownloadPpsZipFile(FileParms fileParms) in D:\Source\Sub\Web Projects\WebStorageApps\PpsTransactionFile\download\DownloadFile.cs:line 155
My code:
public static Status DownloadPpsTransactionFile(FileParms fileParms)
{
var client = new FileServiceClient();
try
{
var downloadstatus = new Status();
downloadstatus.ProgramSendType = fileParms.SendGet;
client.ClientCredentials.UserName.UserName = "xxxxxx";
client.ClientCredentials.UserName.Password = "xxxxxxxxxxx";
var trucks = fileParms.Trucks.Split(Convert.ToChar(","));
foreach (var truck in trucks)
{
int trk;
if (!int.TryParse(truck, out trk))
{
continue;
}
var downloadrequest = new DownloadFileRequest();
downloadrequest.CompanyCode = fileParms.CompanyCode;
downloadrequest.FileType = 1;
downloadrequest.TruckNumber = trk;
DownloadFileResponse download;
do
{
download = client.DownloadPpsTransactionFile(downloadrequest);
It's failing on the last line when I call the wfc method. I cannot seem to get the IIS settings and web.config to work right.
My settings on IIS:
What am I doing wrong?
CLIENT SIDE CONFIG
<?xml version="1.0"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IFileService">
<security mode="Transport">
<transport clientCredentialType="Basic" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="https://SOMEDOMAIN.COM/api/fileservice/FileService.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IFileService"
contract="MyFileServiceReference.IFileService" name="BasicHttpBinding_IFileService" />
</client>
</system.serviceModel>
</configuration>
ADDITIONAL INFO
I found this in the event viewer. I'm currently researching it to see what it means.
FailedRequestTracing module failed to write buffered events to log file for the request that matched failure definition. No logs will be generated until this condition is corrected. The problem happened at least 1 times in the last 5 minutes. The data is the error.