小编Noo*_*r69的帖子

打开文件对话框并使用WPF控件和C#选择文件

我有一个TextBox名字textbox1和一个Button名字button1.当我点击button1我想浏览我的文件只搜索图像文件(类型jpg,png,bmp ...).当我选择一个图像文件并在文件对话框中单击"确定"时,我希望文件目录的写入方式textbox1.text如下:

textbox1.Text = "C:\myfolder\myimage.jpg"
Run Code Online (Sandbox Code Playgroud)

c# wpf textbox openfiledialog

177
推荐指数
2
解决办法
24万
查看次数

服务器未提供有意义的回复,这可能是由于合同不匹配、会话过早关闭或内部服务器错误引起的

我有一个客户端/服务器应用程序,我正在尝试使用我创建的 WCF 服务,但它一直抛出异常,我没有设法弄清楚!

这是WCF服务器的代码:

<configuration>
  <system.serviceModel>
    <serviceHostingEnvironment multipleSiteBindingsEnabled="true">
      <services>
        <service name="ChatService.ChatService"
             behaviorConfiguration="behaviorConfig">

          <host>
            <baseAddresses>
              <add baseAddress="net.tcp://localhost:7997/Host/"/>
              <add baseAddress="http://localhost:7998/Host/"/>
            </baseAddresses>
          </host>
          <endpoint address="tcp"
                binding="netTcpBinding"
                bindingConfiguration="tcpBinding"
                contract="ChatService.IChat"/>

          <endpoint address="net.tcp://localhost:7996/Host/mex"
                binding="mexTcpBinding"
                contract="IMetadataExchange"/>
        </service>
      </services>
    </serviceHostingEnvironment>
    <behaviors>
      <serviceBehaviors>
        <behavior name="behaviorConfig">
          <serviceMetadata httpGetEnabled="true" httpGetUrl=""/>
          <serviceDebug includeExceptionDetailInFaults="false"/>
          <serviceThrottling maxConcurrentCalls="100" maxConcurrentSessions="100"/>
          <dataContractSerializer maxItemsInObjectGraph="2147483647"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
    <bindings>
      <netTcpBinding>
        <binding name="tcpBinding"
                         maxBufferSize="67108864"
                         maxReceivedMessageSize="67108864"
                         maxBufferPoolSize="67108864"
                         transferMode="Buffered"
                         closeTimeout="00:00:10"
                         openTimeout="00:00:10"
                         receiveTimeout="00:20:00"
                         sendTimeout="00:01:00"
                         maxConnections="100">
          <security mode="None">
          </security>
          <readerQuotas maxArrayLength="67108864"
                                  maxBytesPerRead="67108864"
                                  maxStringContentLength="67108864"/>
          <reliableSession enabled="true" inactivityTimeout="00:20:00"/>
        </binding>
      </netTcpBinding>
    </bindings>

  </system.serviceModel>
  </configuration>
Run Code Online (Sandbox Code Playgroud)

这是客户端的 WCF 服务: …

c# wcf client

5
推荐指数
1
解决办法
2万
查看次数

标签 统计

c# ×2

client ×1

openfiledialog ×1

textbox ×1

wcf ×1

wpf ×1