我有一个TextBox
名字textbox1
和一个Button
名字button1
.当我点击button1
我想浏览我的文件只搜索图像文件(类型jpg,png,bmp ...).当我选择一个图像文件并在文件对话框中单击"确定"时,我希望文件目录的写入方式textbox1.text
如下:
textbox1.Text = "C:\myfolder\myimage.jpg"
Run Code Online (Sandbox Code Playgroud) 我有一个客户端/服务器应用程序,我正在尝试使用我创建的 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 服务: …